Update of /cvsroot/activelock/alcrypto
In directory sc8-pr-cvs1:/tmp/cvs-serv26940
Modified Files:
ALCrypto.def MD5.C
Log Message:
Added md5_hash() function.
Index: ALCrypto.def
===================================================================
RCS file: /cvsroot/activelock/alcrypto/ALCrypto.def,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ALCrypto.def 28 Jul 2003 01:01:03 -0000 1.1
+++ ALCrypto.def 31 Jul 2003 05:07:02 -0000 1.2
@@ -13,4 +13,5 @@
rsa_createkey @7
rsa_sign @8
rsa_verifysig @9
-rsa_freekey @10
\ No newline at end of file
+rsa_freekey @10
+md5_hash @11
\ No newline at end of file
Index: MD5.C
===================================================================
RCS file: /cvsroot/activelock/alcrypto/MD5.C,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- MD5.C 28 Jul 2003 01:01:03 -0000 1.1
+++ MD5.C 31 Jul 2003 05:07:02 -0000 1.2
@@ -74,9 +74,9 @@
* Change Log
* ==========
*
- * Date (MM/DD/YY) Author Description
+ * Date (MM/DD/YY) Author Description
* --------------- ----------- --------------------------------------------------------------
- * 07/27/03 th2tran adapted from PuTTY project for used by ActiveLock project.
+ * 07/27/03 th2tran adapted from PuTTY project for used by ActiveLock project.
*
***********************************************************************************************/
@@ -353,3 +353,23 @@
"hmac-md5",
16
};
+
+
+/**
+ * API function to compute MD5 hash.
+ */
+ALCRYPTO_API LRESULT WINAPI md5_hash(unsigned char *in, unsigned char *out)
+{
+ static const char hex[] = "0123456789ABCDEF";
+ struct MD5Context md5c;
+ unsigned char outBytes[16];
+ int i = 0;
+ MD5Init(&md5c);
+ MD5Update(&md5c, in, strlen(in));
+ MD5Final(outBytes, &md5c);
+ out[0] ='\0'; /* reset out buffer */
+ for (i = 0; i < 16;i++) {
+ sprintf(out + strlen(out), "%02x", outBytes[i]);
+ }
+ return 0;
+}
\ No newline at end of file
|