Keyed Hash?

Rob Landley rob at landley.net
Wed Sep 22 20:57:39 UTC 2010


On Monday 20 September 2010 00:26:42 Timo Teräs wrote:
> On 09/20/2010 01:23 AM, Denys Vlasenko wrote:
> >>From a quick experiment it looks like w/o "-hmac KEY"
> >
> > part this command basically does sha1sum'ing.
> >
> > What does -hmac KEY do? It seeds sha1 somehow? How exactly?
>
> Yes, it sort of seeds it with password to allow message authentication.
>
>    To compute HMAC over the data `text' we perform
>          H(K XOR opad | H(K XOR ipad | text))
>
>    where H = hash function used
>          K = password
>          ipad = 0x36, 0x36, ...
>          opad = 0x5c, 0x5c, ...
>
>    and | meaning concenation of binary data.
>
> See also:
>   http://en.wikipedia.org/wiki/HMAC
>   http://tools.ietf.org/html/rfc2104

Ok, I"ll bite.  Why doesn't just going:

  (echo MYPASSPHRASE && cat data) | sha1sum

Do what you want?

Rob
-- 
GPLv3: as worthy a successor as The Phantom Menace, as timely as Duke Nukem 
Forever, and as welcome as New Coke.


More information about the busybox mailing list