Incorrect Hash When Using Unicode
theGeekPirate opened this issue · 1 comments
theGeekPirate commented
Note: I've also verified that the official CLI does not have an issue itself by comparing results from Go's Argon2id implementation, as well as the rust-argon2 crate for Rust.
First Example
argon2-browser:
[00.010] Params: pass=汉字漢字, salt=asdfasdfasdfasdf, time=1, mem=1024, hashLen=32, parallelism=1, type=2
[00.014] Encoded: $argon2id$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$StqKaEOAhPKzr5njhOV49GAx4PRsZKJYH/qKwYOyz2E
[00.014] Hash: 4ada8a68438084f2b3af99e384e578f46031e0f46c64a2581ffa8ac183b2cf61
Official CLI:
> echo -n "汉字漢字" | argon2 asdfasdfasdfasdf -id -t 1 -k 1024 -p 1 -l 32
Type: Argon2id
Iterations: 1
Memory: 1024 KiB
Parallelism: 1
Hash: cf3aa040b123aa2903c08235424d996f2a021b5d83db95bbb574a07a38b0892d
Encoded: $argon2id$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$zzqgQLEjqikDwII1Qk2ZbyoCG12D25W7tXSgejiwiS0
Second Example
argon2-browser:
[00.011] Params: pass=¢, salt=asdfasdfasdfasdf, time=1, mem=1024, hashLen=32, parallelism=1, type=2
[00.015] Encoded: $argon2id$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$/wXzasAT4YKmNPMsBcJwchOroZ7aHNXgh4NQ4WurUnc
[00.015] Hash: ff05f36ac013e182a634f32c05c2707213aba19eda1cd5e0878350e16bab5277
Official CLI:
> echo -n "¢" | argon2 asdfasdfasdfasdf -id -t 1 -k 1024 -p 1 -l 32
Type: Argon2id
Iterations: 1
Memory: 1024 KiB
Parallelism: 1
Hash: dfd4cf692d18cbde3ac98659d29c51af18817870add5b064ec0fcf6cd98c2e4b
Encoded: $argon2id$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$39TPaS0Yy946yYZZ0pxRrxiBeHCt1bBk7A/PbNmMLks