RndPhrase / RndPhrase.js

Javascript module to auto generate secure passwords
2 stars 0 forks source link

Unit tests failing #1

Closed Munter closed 10 years ago

Munter commented 11 years ago

@brinchj I've ported enough functionality for the unit tests to work.

git clone git@github.com:RndPhrase/RndPhrase.js.git
cd RndPhrase.js
npm install
npm test

It seems I have made a mistake while porting the code. The cubehash unit tests run fine, so I am guessing that is not where the problem lies. However there are plenty of other opportunities to introduce errors. Can you spot what I have done wrong?

rlindsgaard commented 10 years ago

Where did you get the hash 'e9hn8rxt33h8pwon' from? If I use seed 'foo' and password 'bar' on domain 'example.net' I get '3vyr0z87hs928a7l' on https://rndphrase.appspot.com. This is what the test result outputs on my machine.

rlindsgaard commented 10 years ago

https://github.com/RndPhrase/RndPhrase.js/pull/2

rlindsgaard commented 10 years ago

Hmm that is weird, 'e9hn8rxt33h8pwon' is in the self test which passes, even though typing yields a different result. Can the old hash be a bug that you stumpled upon?

rlindsgaard commented 10 years ago

This is in fact a bug in the old implementation. The correct hash is '3vyr0z87hs928a7l'. If you look at the original self_test function r.build_generator is invoked with the seed. However in rndphrase_do - the seed is first set with set_seed. The difference is that build_generator uses the argument seed directly, whereas set_seed uses a hashed version of the seed. With the new implementation we always hash the seed (as should be).

Munter commented 10 years ago

Cool. Now, I wonder where I left off on this :)