antelle/argon2-browser

Results of online demo don't match results of official cmd utility

Toideng opened this issue · 1 comments

Official cmd utility output:

Type:		Argon2id
Iterations:	30
Memory:		16384 KiB
Parallelism:	1
Hash:		509b6324c651154a958a10e54ade1b8ecdf61702262c9d71a5d5fa3acf66a66fdf82dff4ee3090cca2715cf01474a6f2b203076549048712249730dfd48041a2
Encoded:	$argon2id$v=19$m=16384,t=30,p=1$c29tZXNhbHQ$UJtjJMZRFUqVihDlSt4bjs32FwImLJ1xpdX6Os9mpm/fgt/07jCQzKJxXPAUdKbysgMHZUkEhxIklzDf1IBBog
0.199 seconds
Verification ok

Output on website:

[00.001] Testing Argon2 using Binaryen native-wasm
[00.001] Calculating hash...
[00.011] Params: pass=password, salt=somesalt, time=30, mem=16384, hashLen=64, parallelism=1, type=2
[01.596] Encoded: $argon2id$v=19$m=16384,t=30,p=1$c29tZXNhbHQ$BYZrABo32arXIFUTNZ6kvvjQVro/9ob7JIy2qkb4LOMUxhICAzwl5KoaWk/0fRnqMU3KIjtVvIPaVRo03p1wsA
[01.597] Hash: 05866b001a37d9aad7205513359ea4bef8d056ba3ff686fb248cb6aa46f82ce314c61202033c25e4aa1a5a4ff47d19ea314dca223b55bc83da551a34de9d70b0
[01.597] Elapsed: 1585ms

So the result calculated by official utility doesn't match result on website:

official: UJtjJMZRFUqVihDlSt4bjs32FwImLJ1xpdX6Os9mpm/fgt/07jCQzKJxXPAUdKbysgMHZUkEhxIklzDf1IBBog
website:  BYZrABo32arXIFUTNZ6kvvjQVro/9ob7JIy2qkb4LOMUxhICAzwl5KoaWk/0fRnqMU3KIjtVvIPaVRo03p1wsA

Steps to reproduce

Download and make from https://github.com/P-H-C/phc-winner-argon2/

Run:

$ ./argon2 somesalt -id -t 30 -m 14 -l 64 <<< "password" > outputfile

EDIT: command line utility reads an 0x0a byte in the end of herestring.

This command outputs matching result:

$ echo -n "password" | ./argon2 somesalt -id -t 30 -m 14 -l 64 > outputfile