summaryrefslogtreecommitdiff
path: root/ext/standard/md5.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2008-02-08 09:11:17 +0000
committerDmitry Stogov <dmitry@php.net>2008-02-08 09:11:17 +0000
commit3ea9c13c4be01cb055e65fbeda034ade5e3c7ed8 (patch)
treef54e121e2fc0c53bff658e9cef4f12050cf3d7e9 /ext/standard/md5.h
parent54680a30fc7f893a559b0dd166872e2e79920ed4 (diff)
downloadphp-git-3ea9c13c4be01cb055e65fbeda034ade5e3c7ed8.tar.gz
Improved md5() implementation (Solar Designer)
Diffstat (limited to 'ext/standard/md5.h')
-rw-r--r--ext/standard/md5.h55
1 files changed, 22 insertions, 33 deletions
diff --git a/ext/standard/md5.h b/ext/standard/md5.h
index ddc4d185e7..464dda4b98 100644
--- a/ext/standard/md5.h
+++ b/ext/standard/md5.h
@@ -12,7 +12,8 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+ | Author: Alexander Peslyak (Solar Designer) <solar at openwall.com> |
+ | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
@@ -20,47 +21,35 @@
#ifndef MD5_H
#define MD5_H
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
+PHPAPI void make_digest(char *md5str, const unsigned char *digest);
+PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len);
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
+PHP_NAMED_FUNCTION(php_if_md5);
+PHP_NAMED_FUNCTION(php_if_md5_file);
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
+#include "ext/standard/basic_functions.h"
- These notices must be retained in any copies of any part of this
- documentation and/or software.
+/*
+ * This is an OpenSSL-compatible implementation of the RSA Data Security,
+ * Inc. MD5 Message-Digest Algorithm (RFC 1321).
+ *
+ * Written by Solar Designer <solar at openwall.com> in 2001, and placed
+ * in the public domain. There's absolutely no warranty.
+ *
+ * See md5.c for more information.
*/
-#include "ext/standard/basic_functions.h"
-
/* MD5 context. */
typedef struct {
- php_uint32 state[4]; /* state (ABCD) */
- php_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
+ php_uint32 lo, hi;
+ php_uint32 a, b, c, d;
+ unsigned char buffer[64];
+ php_uint32 block[16];
} PHP_MD5_CTX;
-PHPAPI void make_digest(char *md5str, unsigned char *digest);
-PHPAPI void make_digest_ex(char *md5str, unsigned char *digest, int len);
-PHPAPI void PHP_MD5Init(PHP_MD5_CTX *);
-PHPAPI void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int);
-PHPAPI void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
-
-PHP_NAMED_FUNCTION(php_if_md5);
-PHP_NAMED_FUNCTION(php_if_md5_file);
+PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx);
+PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size);
+PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx);
#endif