Viktor Szakáts wrote:
Now it's better, but in order to make them give the right results
with SHA384 and SHA512, 64 has to be changed to 128. I'm
lost how to do this in a generic way.
Hi,
why? 64 bytes (binary, not hex) is 512 bits. So, HMAC is OK up to 512 bits.
After reading some docs (rfc4868)
=================================
Well... Me also... The problem is that hash size is completely different
thing than block size. It's possible to do:
IF LEN(EVAL(fFunc, "", .F./*hex, not binary*/)) > 64
IF LEN(cKey) > 128; cKey := ...
ENDIF
cKey := PADR(..., 128)
ELSE
IF LEN(cKey) > 64; cKey := ...
ENDIF
cKey := PADR(..., 64)
ENDIF
But this solution is not very nice. It will not work for some hashing
functions... :(
We can not manage this without storing additional attributes (like block
size) for hashing algorithms. It could implemented using some structures
for cryptographic algorithms registration, but it is not a simple
solution... Perhaps, we must go back to HB_HMAC_*(), or develop more
complicated infrastructure. Does anyone have another ideas?
Regards,
Mindaugas
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour