asmcrypto / asmcrypto.js

JavaScript Cryptographic Library with performance in mind.
MIT License
660 stars 182 forks source link

password,data data,password #71

Closed sentient closed 9 years ago

sentient commented 9 years ago

documentation (https://github.com/vibornoff/asmcrypto.js#hmac_sha256) says

HMAC_SHA256.base64( password, data )

But code is :

function hmac_sha256_base64 ( data, password ) { var result = hmac_sha256_bytes( data, password ); return bytes_to_base64(result); }

Following code seems to be correct, is the documentation outdated?

vibornoff commented 9 years ago

Yep, documentation is outdated. Thanks a lot for paying attention.

pohutukawa commented 9 years ago

Yes, this has also just cost me half a day in tracking down the problem. I only figured it out after checking the source. I just wanted to report it, when seeing that there was a ticket on it already. All the HMAC functions' documentation is "out of whack" with regards to this.

Wouldn't it make sense to use JSDoc strings for the implementations in the source code. That way stuff like that would more easily be found at the time of development, and the actual documentation then can be generated mechanically rather than having to write and maintain it manually?

pohutukawa commented 9 years ago

On another note: There are also no unit tests for the HMAC implementations.