doris7789 / crypto-js

Automatically exported from code.google.com/p/crypto-js
0 stars 0 forks source link

Can only hash strings and not integers #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by benjamin...@gmail.com on 9 Sep 2013 at 11:54

GoogleCodeExporter commented 9 years ago
In 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."

Original comment by Jeff.Mott.OR on 9 Sep 2013 at 11:58

GoogleCodeExporter commented 9 years ago
My apologies for overlooking this. Feel incredibly stupid now.

Original comment by benjamin...@gmail.com on 10 Sep 2013 at 12:05

GoogleCodeExporter commented 9 years ago
No worries.

Original comment by Jeff.Mott.OR on 10 Sep 2013 at 12:06