Creating a MAC

Werner Koch wk at gnupg.org
Thu Aug 18 11:18:14 CEST 2005


On Wed, 17 Aug 2005 22:14:34 +0200, Folkert van Heusden said:

> int SHA_Init(SHA_CTX *c);
> int SHA_Update(SHA_CTX *c, const void *data, unsigned long len);
> int SHA_Final(unsigned char *md, SHA_CTX *c);

That does not produce a MAC.  BTW, with Libgcrypt you can do the above
even in one step:

   gcry_md_hash_buffer (GCRY_MD_SHA1, void *digest,
                        const void *buffer, size_t length);
 
Please let me remark again that basic cryptographic knowledge is
required to develop application with Libgcrypt.  Schneier's "Practical
Cryptography" seems to be a very good resource.

An example on how to implement MACing may be found in
ftp://ftp.gnupg.org/gcrypt/alpha/gsti/gsti-0.3.0.tar.bz2 which
implements the Secure Shell (ssh) protocol.


Shalom-Salam,

   Werner





More information about the Gnupg-devel mailing list