-
Notifications
You must be signed in to change notification settings - Fork 1
/
sha3_module.c
60 lines (44 loc) · 1.2 KB
/
sha3_module.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* Copyright (c) 2012 Adam Jakubek
* Released under the MIT license (see attached LICENSE file).
*/
#include "common.h"
#include "sha3_types.h"
static PyMethodDef sha3_methods[] =
{
{ NULL } /* sentinel */
};
#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
#define PyMODINIT_FUNC void
#endif
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef sha3_moduledef = {
PyModuleDef_HEAD_INIT,
"sha3", /* m_name */
"SHA-3 hashing functions.", /* m_doc */
-1, /* m_size */
sha3_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC PyInit_sha3(void)
{
PyObject* m;
if (!sha3_init_types())
return NULL;
m = PyModule_Create(&sha3_moduledef);
sha3_register_types(m);
return m;
}
#else
PyMODINIT_FUNC initsha3(void)
{
PyObject* m;
if (!sha3_init_types())
return;
m = Py_InitModule3("sha3", sha3_methods,
"SHA-3 hashing functions.");
sha3_register_types(m);
}
#endif