1π
β
In your Node code, you have this:
var salt = new Buffer(this.salt, 'base64');
This assumes that this.salt
is a Base64 encoded string containing the salt. It is subsequently decoded into a Buffer
. So, salt
is a (binary) buffer.
In your Python code, you have this:
salt = base64.b64encode(b'salt')
This takes the binary string salt
and Base64-encodes it. So, salt
is a (Base64-encoded) string.
Notice the type mismatch between Node (binary buffer) and Python (Base64-encoded string)?
Instead, use this in your Python code:
salt = b'salt'
Or allow the Python code to take a Base64-encoded string as salt, and decode it:
salt = base64.b64decode('c2FsdA==')
π€robertklep
Source:stackexchange.com