]> granicus.if.org Git - python/commitdiff
Use unicode
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 25 Aug 2007 08:01:41 +0000 (08:01 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 25 Aug 2007 08:01:41 +0000 (08:01 +0000)
Modules/sha256module.c
Modules/sha512module.c

index 5b49c9f4d5de422f11ce151c14f64fe61e13fad2..27c4b19b9c237330bf25ab6648bb1e67ee285f7f 100644 (file)
@@ -444,7 +444,7 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused)
     unsigned char digest[SHA_DIGESTSIZE];
     SHAobject temp;
     PyObject *retval;
-    char *hex_digest;
+    Py_UNICODE *hex_digest;
     int i, j;
 
     /* Get the raw (binary) digest value */
@@ -452,10 +452,10 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused)
     sha_final(digest, &temp);
 
     /* Create a new string */
-    retval = PyString_FromStringAndSize(NULL, self->digestsize * 2);
+    retval = PyUnicode_FromStringAndSize(NULL, self->digestsize * 2);
     if (!retval)
            return NULL;
-    hex_digest = PyString_AsString(retval);
+    hex_digest = PyUnicode_AS_UNICODE(retval);
     if (!hex_digest) {
            Py_DECREF(retval);
            return NULL;
index 5eedb4cd680de3323fe3fc88d4e9bcda0536dca4..1d3a70b9dfa1d5fed61215be514eebb8382fd953 100644 (file)
@@ -510,7 +510,7 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
     unsigned char digest[SHA_DIGESTSIZE];
     SHAobject temp;
     PyObject *retval;
-    char *hex_digest;
+    Py_UNICODE *hex_digest;
     int i, j;
 
     /* Get the raw (binary) digest value */
@@ -518,10 +518,10 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
     sha512_final(digest, &temp);
 
     /* Create a new string */
-    retval = PyString_FromStringAndSize(NULL, self->digestsize * 2);
+    retval = PyUnicode_FromStringAndSize(NULL, self->digestsize * 2);
     if (!retval)
            return NULL;
-    hex_digest = PyString_AsString(retval);
+    hex_digest = PyUnicode_AS_UNICODE(retval);
     if (!hex_digest) {
            Py_DECREF(retval);
            return NULL;