johnallsup / crypto-js

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

invalid SHA256 hash #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Do this: Crypto.SHA256('\xff')

What is the expected output? What do you see instead?
The hash should be (tested in Python):
a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89
But is:
ea47fa96cf6d727d3068913da9193fef44aec4ee2c5972e9ac50cf7d637a56cf

What version of the product are you using? On what operating system?
I am using Crypto-js version 2.5.2. I tried the fix in issue #16, but it 
doesn't work (same output).

Please provide any additional information below.
The other hash is one using Python: hashlib.sha256('\xff').hexdigest()

Original issue reported on code.google.com by aykevanl...@gmail.com on 7 Jan 2012 at 8:57

GoogleCodeExporter commented 9 years ago
Note: I use Chromium 15.0.874.106 (Developer Build 107270 Linux) Ubuntu 11.10

Original comment by aykevanl...@gmail.com on 7 Jan 2012 at 8:58

GoogleCodeExporter commented 9 years ago
Sorry, my fault. Unicode and binary aren't the same. This works:
Crypto.SHA256(Crypto.charenc.Binary.stringToBytes('\xff'))

Original comment by aykevanl...@gmail.com on 7 Jan 2012 at 9:09

GoogleCodeExporter commented 9 years ago

Original comment by Jeff.Mott.OR on 7 Jan 2012 at 11:07