2004-07-18 00:24:25 +00:00
|
|
|
/* $Id$ */
|
2007-01-09 15:50:55 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2003-2005 Benny Prijono <benny@prijono.org>
|
|
|
|
*
|
|
|
|
* MD5 code from pjlib-util http://www.pjsip.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2002-12-17 04:05:25 +00:00
|
|
|
*/
|
2010-08-28 19:27:19 +00:00
|
|
|
#ifndef __MD5_H__ /**@todo Should this be _CRYPT_MD5_H__ ?*/
|
2007-01-09 15:50:55 +00:00
|
|
|
#define __MD5_H__
|
2002-12-17 04:05:25 +00:00
|
|
|
|
2007-01-09 15:50:55 +00:00
|
|
|
/**
|
2010-08-26 06:46:30 +00:00
|
|
|
* @file crypt-md5.h
|
2007-01-09 15:50:55 +00:00
|
|
|
* @brief MD5 Functions
|
2002-12-17 04:05:25 +00:00
|
|
|
*/
|
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/* Don't define this group for Wireshark
|
2007-01-09 15:50:55 +00:00
|
|
|
* @defgroup PJLIB_UTIL_MD5 MD5 Functions
|
|
|
|
* @ingroup PJLIB_UTIL
|
|
|
|
* @{
|
|
|
|
*/
|
2002-12-17 04:05:25 +00:00
|
|
|
|
2007-01-09 15:50:55 +00:00
|
|
|
#define md5_byte_t guint8
|
2002-12-17 04:05:25 +00:00
|
|
|
|
2007-01-09 15:50:55 +00:00
|
|
|
/** MD5 context. */
|
|
|
|
typedef struct md5_state_s
|
2002-12-17 04:05:25 +00:00
|
|
|
{
|
2007-01-09 15:50:55 +00:00
|
|
|
guint32 buf[4];
|
|
|
|
guint32 bits[2];
|
2007-04-23 21:12:04 +00:00
|
|
|
guint32 in[16];
|
2007-01-09 15:50:55 +00:00
|
|
|
} md5_state_t;
|
2002-12-17 04:05:25 +00:00
|
|
|
|
2007-01-09 15:50:55 +00:00
|
|
|
/** Initialize the algorithm.
|
|
|
|
* @param pms MD5 context.
|
|
|
|
*/
|
2002-12-17 04:05:25 +00:00
|
|
|
void md5_init(md5_state_t *pms);
|
|
|
|
|
2007-01-09 15:50:55 +00:00
|
|
|
/** Append a string to the message.
|
|
|
|
* @param pms MD5 context.
|
|
|
|
* @param data Data.
|
|
|
|
* @param nbytes Length of data.
|
|
|
|
*/
|
|
|
|
void md5_append( md5_state_t *pms,
|
2009-04-03 15:44:08 +00:00
|
|
|
const guint8 *data, size_t nbytes);
|
2007-01-09 15:50:55 +00:00
|
|
|
|
|
|
|
/** Finish the message and return the digest.
|
|
|
|
* @param pms MD5 context.
|
|
|
|
* @param digest 16 byte digest.
|
|
|
|
*/
|
|
|
|
void md5_finish(md5_state_t *pms, guint8 digest[16]);
|
2002-12-17 04:05:25 +00:00
|
|
|
|
|
|
|
|
2009-04-03 15:44:08 +00:00
|
|
|
void md5_hmac(const guint8* text, size_t text_len, const guint8* key, size_t key_len, guint8 digest[16]);
|
2005-03-09 07:29:52 +00:00
|
|
|
|
2010-08-29 10:47:38 +00:00
|
|
|
/*
|
2007-01-09 15:50:55 +00:00
|
|
|
* @}
|
|
|
|
*/
|
2002-12-17 04:05:25 +00:00
|
|
|
|
2007-01-09 15:50:55 +00:00
|
|
|
#endif /* _CRYPT_MD5_H__ */
|