What algorithm for HMAC?

Discussion related to AES Crypt, the file encryption software for Windows, Linux, Mac, and Java.
Post Reply
e3anderp
Posts: 2
Joined: Mon Nov 14, 2011 7:20 pm
Contact:

What algorithm for HMAC?

Post by e3anderp » Mon Nov 14, 2011 7:34 pm

Hi,

I am planning to implement a small tool that will encrypt large numbers of files and I find the AES file format used in AESCrypt suitable for my needs - I see no reason to reinvent the wheel there.

Anyway, all is clear to me except one thing, the HMAC.

In another thread here on the forum there is a link to Wikipedia regarding the HMAC, but that page lists "examples of HMAC" using MD5, SHA1 and SHA256. RFC 2104 also states that any iterative hash algorithm can be used.

Given the length of the HMAC fields in the file format, is SHA256 the only algorithm that can be used (HMAC-SHA-256)?

User avatar
paulej
Posts: 521
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: What algorithm for HMAC?

Post by paulej » Mon Nov 14, 2011 10:08 pm

HMAC can be used with any kind of hash. It's a fairly simple algorithm:

Code: Select all

H(K XOR opad, H(K XOR ipad, text))
Any hash function could be used, but AES Crypt only uses SHA256. Look at the Linux source code for the most straight-forward and readable example usage.

e3anderp
Posts: 2
Joined: Mon Nov 14, 2011 7:20 pm
Contact:

Re: What algorithm for HMAC?

Post by e3anderp » Tue Nov 15, 2011 8:31 am

OK, thanks for the info - I'll have a look att the Linux implementation.

I'm going to use C# and .NET for my Windows app, hopefully the HMACSHA256 class does the same thing as the Aescrypt HMAC implementation. (http://msdn.microsoft.com/en-us/library ... ha256.aspx)

Post Reply