2 * UCW Library -- MD5 Binary <-> Hex Conversions
4 * (c) 1997 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
11 #include "lib/chartype.h"
16 md5_to_hex(byte *s, byte *d)
19 for(i=0; i<MD5_SIZE; i++)
20 d += sprintf(d, "%02X", *s++);
24 hex_to_md5(byte *s, byte *d)
27 for(i=0; i<MD5_SIZE; i++)
29 if (!Cxdigit(s[0]) || !Cxdigit(s[1]))
30 die("hex_to_md5: syntax error");
32 j = (j << 4) | Cxvalue(*s); s++;