Use unicode

This commit is contained in:
Neal Norwitz 2007-08-25 08:01:41 +00:00
parent a369c5aba6
commit b4e2f76d24
2 changed files with 6 additions and 6 deletions

View 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;

View 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;