mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Implement PEP 393.
This commit is contained in:
parent
48d49497c5
commit
d63a3b8beb
102 changed files with 8153 additions and 5431 deletions
|
|
@ -511,7 +511,7 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
|
|||
unsigned char digest[SHA_DIGESTSIZE];
|
||||
SHAobject temp;
|
||||
PyObject *retval;
|
||||
Py_UNICODE *hex_digest;
|
||||
Py_UCS1 *hex_digest;
|
||||
int i, j;
|
||||
|
||||
/* Get the raw (binary) digest value */
|
||||
|
|
@ -519,14 +519,10 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
|
|||
sha512_final(digest, &temp);
|
||||
|
||||
/* Create a new string */
|
||||
retval = PyUnicode_FromStringAndSize(NULL, self->digestsize * 2);
|
||||
retval = PyUnicode_New(self->digestsize * 2, 127);
|
||||
if (!retval)
|
||||
return NULL;
|
||||
hex_digest = PyUnicode_AS_UNICODE(retval);
|
||||
if (!hex_digest) {
|
||||
Py_DECREF(retval);
|
||||
return NULL;
|
||||
}
|
||||
hex_digest = PyUnicode_1BYTE_DATA(retval);
|
||||
|
||||
/* Make hex version of the digest */
|
||||
for (i=j=0; i<self->digestsize; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue