Last active
November 11, 2015 12:01
-
-
Save sbp/1067cd7047486832ea76 to your computer and use it in GitHub Desktop.
Patch to make simplesha3 (Version 20150922) Python 3 compatible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ diff -Naur simplesha3.djb.c simplesha3.c | |
--- simplesha3.djb.c 2015-09-22 11:28:31.000000000 +0100 | |
+++ simplesha3.c 2015-11-11 11:59:16.000000000 +0000 | |
@@ -11,7 +11,7 @@ | |
int n; \ | |
if (!PyArg_ParseTuple(args,"s#:update",&m,&n)) return 0; \ | |
Keccak(r*8,m,n,p,h,d); \ | |
- return PyString_FromStringAndSize((const char *)h,d); \ | |
+ return PyBytes_FromStringAndSize((const char *)h,d); \ | |
} \ | |
PyDoc_STRVAR(i##_doc,"Return the "name" digest of the input string."); | |
@@ -49,7 +49,9 @@ | |
{0,0} | |
}; | |
-PyMODINIT_FUNC initsimplesha3(void) | |
+PyMODINIT_FUNC PyInit_simplesha3(void) | |
{ | |
- Py_InitModule("simplesha3",functions); | |
+ static struct PyModuleDef moduledef = { | |
+ PyModuleDef_HEAD_INIT, "simplesha3", "simplesha3", -1, functions, }; | |
+ PyModule_Create(&moduledef); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment