1). What steps will reproduce the problem?
var number = 11111; var string = number.toString(); var actual = CryptoJS.SHA256("11111"); var hash1 = CryptoJS.SHA256(number); var result1 = CryptoJS.SHA256(string);
2.) What is the expected output? What do you see instead?
hash1 is undefined but result1 produces a hash. result1 == actual.
3) What version of the product are you using? On what operating system?
CryptoJS 3.0.1 Firefox 23.0.1 Arch Linux x86_64 kernel: 3.10.10-1-ARCH
4). Please provide any additional information below.
If this is not a bug please make it clearer in the documentation that passing a straight number to a hashing function will return undefined.
Comment #1
Posted on Sep 9, 2013 by Happy HorseIn the section The_Hasher_Input (https://code.google.com/p/crypto-js/#The_Hasher_Input) it says that "The hash algorithms accept either strings or instances of CryptoJS.lib.WordArray."
Comment #2
Posted on Sep 10, 2013 by Happy ElephantMy apologies for overlooking this. Feel incredibly stupid now.
Comment #3
Posted on Sep 10, 2013 by Happy HorseNo worries.
Status: Invalid
Labels:
Type-Defect
Priority-Medium