2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: hmac_md5.c,v 1.2.4.1 2006-11-26 21:06:02 zer0 Exp $
25 void HMAC_MD5 (unsigned char *output, const unsigned char *input,
26 unsigned char *key, unsigned int inputLen, unsigned int keyLen)
30 unsigned char key_tmp[64];
33 key_tmp[i] = (i<keyLen)?key[i]^0x36:0x36;
36 MD5Update(&context, key_tmp, 64);
37 MD5Update(&context, input, inputLen);
38 MD5Final(output, &context);
41 key_tmp[i] = (i<keyLen)?key[i]^0x5c:0x5c;
45 MD5Update(&context, key_tmp, 64);
46 MD5Update(&context, output, 16);
47 MD5Final(output, &context);