Here's the code:

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



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

(From c2FsdDEyMzEyMzEyMw -> salt123123123)


1 Answer 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"))


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.