minssl
Software
www.skarnet.org
The hash127mac library implements keyed hash message authentication using the fast hash127 message authenticator and the RC4 pseudorandom number generator.
unsigned int len ; unsigned char const *key ; H127MACSchedule ctx ; hash127mac_init(&ctx, key, len) ;
hash127mac_init() initializes the ctx H127MACSchedule structure with len bytes of secret read from key. The first 16 bytes are the hash127 secret ; the rest are used to initialize a RC4 generator. To be secure, the total secret length must be greater than 48. minssl uses 80-byte secrets.
H127MACSchedule ctx ; int32 mac[4] ; char const *message ; unsigned int len ; hash127mac(&ctx, mac, message, len) ;
hash127mac() computes a secure authenticator for message of length len, and stores it into mac. Be careful: message must be aligned like an array of int32, and its length must be a multiple of 4. Pad it with zeros if you need.
hash127mac() uses a RC4-generated pseudorandom number as the hash127 k[n] secret, so the receiver side has to check the message authenticators in the same order as the sender side computes them. hash127mac is the ideal authenticator to use with a stream cipher, but its use is very limited otherwise.