sql - How to select SHA1 hash values correctly? -


i need extract sha1 passwords microsoft sql server database in order use them in external system.

when simple select query known password, result (password "password"):

"{sha1=5b9febc2d7429c8f2002721484a71a84c12730c7}" 

but should 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8.

any idea how select expected value 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8?

sha1 hashing done on bytes, not on characters, therefore it's important make sure conversion characters bytes done agreed upon encoding.

5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 sha1 hash of password encoded in ascii/utf-8.

5b9febc2d7429c8f2002721484a71a84c12730c7 sha1 hash of password encoded in utf-16-be.

to fix this, pick 1 encoding, , change whatever code using other encoding match.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -