summaryrefslogtreecommitdiffstats
path: root/Modules/md5module.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-14 00:13:11 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-14 00:13:11 (GMT)
commitf5cff56a1be70d2c4e5cde5fa4e5d5d92e620dda (patch)
tree0eb7ea39ee5a60f384db53d5729b48d73986920d /Modules/md5module.c
parente506437b52507609772e8141fdbb5ad2e17471bb (diff)
downloadcpython-f5cff56a1be70d2c4e5cde5fa4e5d5d92e620dda.zip
cpython-f5cff56a1be70d2c4e5cde5fa4e5d5d92e620dda.tar.gz
cpython-f5cff56a1be70d2c4e5cde5fa4e5d5d92e620dda.tar.bz2
Issue #13088: Add shared Py_hexdigits constant to format a number into base 16
Diffstat (limited to 'Modules/md5module.c')
-rw-r--r--Modules/md5module.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/md5module.c b/Modules/md5module.c
index b6ab5ca..86f602e 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -391,13 +391,11 @@ MD5_hexdigest(MD5object *self, PyObject *unused)
/* Make hex version of the digest */
for(i=j=0; i<MD5_DIGESTSIZE; i++) {
- char c;
+ unsigned char c;
c = (digest[i] >> 4) & 0xf;
- c = (c>9) ? c+'a'-10 : c + '0';
- hex_digest[j++] = c;
+ hex_digest[j++] = Py_hexdigits[c];
c = (digest[i] & 0xf);
- c = (c>9) ? c+'a'-10 : c + '0';
- hex_digest[j++] = c;
+ hex_digest[j++] = Py_hexdigits[c];
}
return retval;
}