Migrating Java Shiro Simple Hashes to NodeJS

Viewed 22

In my Company, we used to hash passwords like this in Java, using Shiro's SimpleHash class:

new SimpleHash("SHA-512", password, salt, 1024).toBase64()

Now, we need to migrate these hashes to NodeJS, i.e. I need to be able to hash passwords in the exact same way to compare them.

So far, I have tried this using the pbldf2 function from NodeJS's crypto module:

// the key length of 64 was determined by looking at the output of SimpleHash, these are 64 bytes long
pbkdf2Sync(password, salt, 1024, 64, 'sha512').toString('base64')

However, the produced hashes are not the same. I have also tried using crypto's createHmac function, but the hashes produced by it did not match either. Notably, I was unable to tell createHmac how many iterations should be used.

0 Answers
Related