Bcrypt hashes generated by golang will not validate in node.js and vice versa
Get one external dependency:
go get golang.org/x/crypto/bcrypt
Then run:
go run main.go
Should yield something like:
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2a$10$yDx0jD0j5tJKxJIE5jUFx.Kl86.UIA1KePuV7WFX2qcRPAnrRaSfm
Get dependencies:
npm install bcrypt@2 sha256
Then run:
node main.js
Should yield something like:
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2b$10$Hr7K1hpiyqnawyVvn4MfzejtVvHRpcmqqwXFUWyKds03ZLDFDg8O2
Get dependencies:
pip install bcrypt
Then run:
python main.py
Should yield something like:
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2b$10$ioCPS0vXBP0QyewT9t8DP.WcCF4XGlGwpj7wgMHdVIkV.FHsbWg2y
Go -> Node.js
$ node main.js '$2a$10$yDx0jD0j5tJKxJIE5jUFx.Kl86.UIA1KePuV7WFX2qcRPAnrRaSfm'
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2b$10$Qrc3PkcZnAHMKd0pLq/Sye2I4Vib2bi/5Zpgq.Vhcl.WqHOkQ1mq.
Comparing password to hash passed in...
Hash Comparing: $2a$10$yDx0jD0j5tJKxJIE5jUFx.Kl86.UIA1KePuV7WFX2qcRPAnrRaSfm
Match: false
Node.js -> Go
$ go run main.go '$2b$10$Hr7K1hpiyqnawyVvn4MfzejtVvHRpcmqqwXFUWyKds03ZLDFDg8O2'
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2a$10$fYA7OaznvFQL5g6XBKsU/u52/NWhdSaerSp8P0.PabOamcju8kYCu
Comparing password to hash passed in...
Hash Comparing: $2b$10$Hr7K1hpiyqnawyVvn4MfzejtVvHRpcmqqwXFUWyKds03ZLDFDg8O2
Match: false
Python -> Go
$ python main.py '$2b$10$ioCPS0vXBP0QyewT9t8DP.WcCF4XGlGwpj7wgMHdVIkV.FHsbWg2y'
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2a$10$eiqKK07cvV.ZR45iRZHLWOaBHF63xYqCoPexUQKcaXsUv0kA0zsqm
Comparing password to hash passed in...
Hash Comparing: $2b$10$ioCPS0vXBP0QyewT9t8DP.WcCF4XGlGwpj7wgMHdVIkV.FHsbWg2y
Match: false
Python -> Node.js
$ node main.js '$2b$10$h6GPE8lFIZoW6xvE8UzKuufqr1ua/WVN5ue7H1jYQo7Yl8QUqxk4m'
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2b$10$K/5/HmIhN3FwbAboEhon2.6lAYj.2.crOxKpw0ONXWmvPzK26C7ty
Comparing password to hash passed in...
Hash Comparing: $2b$10$h6GPE8lFIZoW6xvE8UzKuufqr1ua/WVN5ue7H1jYQo7Yl8QUqxk4m
Match: true
Go -> Python
$ python main.py '$2a$10$EC8KTl9VI25iGvceRA376uID51Nz6GO6pGjaqLTPB/fs.n.9sEocC'
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2b$10$gyBlTqRiaPHrDoiQNQbj8OKjCKvb9y8xqJShpVKK6BXmvVDIsNKqm
Comparing password to hash passed in...
Hash Comparing: $2a$10$EC8KTl9VI25iGvceRA376uID51Nz6GO6pGjaqLTPB/fs.n.9sEocC
Match: False
Node.js -> Python
$ python main.py '$2b$10$HaiWH3kvMocyvfGTtdsrieOpRNE1eIXpDxzZYXfhHoZ6LW6oSCopG'
Hashing: pass@word1
sha256: 09dad9377a46ce39ee4f8f9baee5cd3117e6732bf9e816c51227c6cdc0851635
bcrypt: $2b$10$8Y1zWwkEvw1qUXlIt0WVIekbXgFR1uXenDRi2.8au3H8OUN.4rsdq
Comparing password to hash passed in...
Hash Comparing: $2b$10$HaiWH3kvMocyvfGTtdsrieOpRNE1eIXpDxzZYXfhHoZ6LW6oSCopG
Match: True