[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNU Crypto] Small problem with HMac
From: |
Raif S. Naffah |
Subject: |
Re: [GNU Crypto] Small problem with HMac |
Date: |
Fri, 10 Jan 2003 02:42:32 +1100 |
User-agent: |
KMail/1.4.3 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
hello Casey,
On Thursday 09 January 2003 23:22, Casey Marshall wrote:
> Hi,
>
> It looks like there is a small problem with how HMac is reset...
>
> The attached seems to fix this...
>
> @@ -180,18 +184,31 @@
> underlyingHash.reset();
> opadHash = (IMessageDigest) underlyingHash.clone();
>
> + ipad = new byte[blockSize];
> +
this allocates new byte array _every_ time an hmac is init-ed. we only
need doing that for new keys, and only if the key length is different
from the previously used initialisation (if there was one). once ipad
is present, there's no need to worry about it being set to zero-bytes,
since it will get populated with K ^ IPAD.
a test case of a re-use would be nice to have ;-)
cheers;
rsn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Que du magnifique
iD8DBQE+HZhp+e1AKnsTRiERAzdeAJ4jtdBy8fgKIlGqK4hPufYBRxF80wCgzy1t
wNoubkPXGi2hGioFW11tMWM=
=lpTh
-----END PGP SIGNATURE-----