1

Here's the code:

salt = b'salt123123123'
password = 'password123'
hash_password = argon2.PasswordHasher().hash(password.encode('UTF-8'), salt = salt)

Returns

$argon2id$v=19$m=65536,t=3,p=4$c2FsdDEyMzEyMzEyMw$GJrdl/EO1WTelvwalnJsSc/JcMsS0LGEVsIwcd/xSIU

The salt here is c2FsdDEyMzEyMzEyMw, how can i get back the original salt?

(From c2FsdDEyMzEyMzEyMw -> salt123123123)

Coffee
  • 11
  • 1

1 Answers1

1

c2FsdDEyMzEyMzEyMw is encoded with base64 but has its padding chopped off. In Python you can decode it quite easily:

import base64

def b64decode(b64str): padding = "=" * (-len(b64str) % 4) return base64.decodebytes(f"{b64str}{padding}".encode("ascii"))

print(b64decode("c2FsdDEyMzEyMzEyMw"))

Please note that base64 is not an encryption scheme but a type of encoding.

eaon
  • 11
  • 2