git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new option polygonoutlines
[swftools.git]
/
lib
/
MD5.c
diff --git
a/lib/MD5.c
b/lib/MD5.c
index
cfadea1
..
d1544ab
100644
(file)
--- a/
lib/MD5.c
+++ b/
lib/MD5.c
@@
-30,6
+30,8
@@
* SUCH DAMAGE.
*/
* SUCH DAMAGE.
*/
+#include "../config.h"
+
#include <string.h>
#ifndef _NETINET6_MD5_H_
#include <string.h>
#ifndef _NETINET6_MD5_H_
@@
-37,6
+39,20
@@
#define MD5_BUFLEN 64
#define MD5_BUFLEN 64
+#ifndef LITTLE_ENDIAN
+#define LITTLE_ENDIAN 1
+#endif
+#ifndef BIG_ENDIAN
+#define BIG_ENDIAN 2
+#endif
+#ifndef BYTE_ORDER
+#ifdef WORDS_BIGENDIAN
+#define BYTE_ORDER BIG_ENDIAN
+#else
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+#endif
+
typedef long unsigned int u_int32_t;
typedef long long unsigned int u_int64_t;
typedef unsigned char u_int8_t;
typedef long unsigned int u_int32_t;
typedef long long unsigned int u_int64_t;
typedef unsigned char u_int8_t;
@@
-120,6
+136,20
@@
do { \
* UNIX password
*/
* UNIX password
*/
+#ifndef HAVE_BCOPY
+void bcopy(const void*src, void*dest, int len)
+{
+ memcpy(dest, src, len);
+}
+#endif
+
+#ifndef HAVE_BZERO
+void bzero(void*mem, int len)
+{
+ memset(mem, 0, len);
+}
+#endif
+
#define MD4_SIZE 16
#define MD5_SIZE 16
#define MD4_SIZE 16
#define MD5_SIZE 16
@@
-135,6
+165,16
@@
_crypt_to64(char *s, u_long v, int n)
}
}
}
}
+void hash_md5(const unsigned char*buf, int len, unsigned char*dest)
+{
+ u_char final[MD5_SIZE];
+
+ MD5_CTX ctx;
+ MD5Init(&ctx);
+ MD5Update(&ctx, buf, len);
+ MD5Final(dest, &ctx);
+}
+
char * crypt_md5(const char *pw, const char *salt)
{
MD5_CTX ctx,ctx1;
char * crypt_md5(const char *pw, const char *salt)
{
MD5_CTX ctx,ctx1;
@@
-467,10
+507,6
@@
static void md5_result(digest, ctxt)
#endif
}
#endif
}
-#if BYTE_ORDER == BIG_ENDIAN
-u_int32_t X[16];
-#endif
-
static void md5_calc(b64, ctxt)
u_int8_t *b64;
md5_ctxt *ctxt;
static void md5_calc(b64, ctxt)
u_int8_t *b64;
md5_ctxt *ctxt;
@@
-483,6
+519,7
@@
static void md5_calc(b64, ctxt)
u_int32_t *X = (u_int32_t *)b64;
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_int32_t *X = (u_int32_t *)b64;
#endif
#if BYTE_ORDER == BIG_ENDIAN
+ u_int32_t X[16];
/* 4 byte words */
/* what a brute force but fast! */
u_int8_t *y = (u_int8_t *)X;
/* 4 byte words */
/* what a brute force but fast! */
u_int8_t *y = (u_int8_t *)X;