diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-05 10:00:53 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-05 10:00:53 +0000 |
commit | 3bf24b9336184fe9e28f7e09b9c5200a5f82b7d2 (patch) | |
tree | 51ccac6f26dcdf9fcfac1a7879477bfde2759b80 /libsylph/md5.h | |
parent | 11776e5a524745b01ac145439ac2892a29bd0826 (diff) |
moved more modules to libsylph.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@548 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/md5.h')
-rw-r--r-- | libsylph/md5.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/libsylph/md5.h b/libsylph/md5.h new file mode 100644 index 00000000..84894b2c --- /dev/null +++ b/libsylph/md5.h @@ -0,0 +1,49 @@ +/* md5.h - MD5 Message-Digest Algorithm + * Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc. + * + * according to the definition of MD5 in RFC 1321 from April 1992. + * NOTE: This is *not* the same file as the one from glibc + * + * 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, 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. + */ + +#ifndef _MD5_HDR_ +#define _MD5_HDR_ + +#include "utils.h" + +typedef struct { /* Hmm, should be private */ + u32 A,B,C,D; + u32 nblocks; + unsigned char buf[64]; + int count; + int finalized; +} MD5_CONTEXT; + +void md5_init(MD5_CONTEXT *ctx); +void md5_update(MD5_CONTEXT *hd, const unsigned char *inbuf, size_t inlen); +void md5_final(unsigned char *digest, MD5_CONTEXT *ctx); + +void md5_hex_digest(char *hexdigest, const unsigned char *s); + +void md5_hmac(unsigned char *digest, + const unsigned char* text, int text_len, + const unsigned char* key, int key_len); +void md5_hex_hmac(char *hexdigest, + const unsigned char* text, int text_len, + const unsigned char* key, int key_len); + +#endif /* _MD5_HDR_ */ + |