summaryrefslogtreecommitdiffstats
path: root/Modules/sha512module.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/sha512module.c')
-rw-r--r--Modules/sha512module.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/sha512module.c b/Modules/sha512module.c
index 4177000..4f5a113 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -526,13 +526,11 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
/* Make hex version of the digest */
for (i=j=0; i<self->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;
}