Cryptography troubles (MAC Progress - Java)

Posted by slanix on 16-Dec-2008 01:22

On the progress side I create a message digest by SHA1-DIGEST(msg, key). On the java side I create message digest from the same msg and key, but results are different. Why? In java I use next code

Mac m = Mac.getInstance("HmacSHA1");

m.init(key);

m.update(msg);

The msg and key binary representation values identical on both sides.

All Replies

Posted by Thomas Mercer-Hursh on 16-Dec-2008 11:20

Saying what the difference is might help produce an answer. We had something similar go by on the PEG recently for BASE-64 where the issue was trailing nulls in the string being converted. So, I would show you ABL code and the two results and someone might recognize the issue.

Posted by slanix on 17-Dec-2008 04:39

I discover how works SHA1-DIGEST(msg, key) function and was shocked!!

It's equal SHA1-DIGEST function invocation with one parameter which present union of key and msg Is it HMAC?

HMAC = HASH((KEY xor OPAD)||HASH((KEY xor IPAD)||MSG)) where

|| - concatenation

OPAD — 0x5c5c..5c

IPAD — 0x3636..36

but actually SHA1-DIGEST(msg,key) function algorithm is

"HMAC" = HASH(KEY||MSG) )

Am I right?

This thread is closed