warjiang / crypto-js

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

Hmac sha1 don't give same output as Java implementation. #89

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am trying to implement OCRA algorithm in Javascript using CryptoJS. I casted 
code from Java to Javascript, replacing Hmac function by the one used in Crypto 
JS.

The problem is that the generated hash using SHA1 algorithm is totally 
different from the one given by the Java implementation.

You can find attach Java source and my Javascript source. Hope you will find  
where the problem comes form. Just before to call the HMAC function i outputted 
key and message in both version (Javascript, and Java) to ensure it is exactly 
the same byte array, and it is actually. 

Original issue reported on code.google.com by felix.vo...@gmail.com on 23 Jun 2013 at 11:42

Attachments:

GoogleCodeExporter commented 8 years ago
It isn't obvious to me from your JavaScript output which HMAC is failing. It 
would be much simpler if you could provide: "Using hasher H, message M, and key 
K, I expect to get output X, but I actually get Y." Also, make sure to mention 
which browser and version you're running.

Original comment by Jeff.Mott.OR on 23 Jun 2013 at 4:19

GoogleCodeExporter commented 8 years ago
Closing unless or until a simple and straightforward failing case is provided.

Original comment by Jeff.Mott.OR on 25 Jun 2013 at 5:32