◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
58 changes: 30 additions & 28 deletions Modules/sha256module.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,43 +681,45 @@ static struct PyMethodDef SHA_functions[] = {
{NULL, NULL} /* Sentinel */
};


/* Initialize this module. */

static struct PyModuleDef _sha256module = {
PyModuleDef_HEAD_INIT,
"_sha256",
NULL,
-1,
SHA_functions,
NULL,
NULL,
NULL,
NULL
};

PyMODINIT_FUNC
PyInit__sha256(void)
{
PyObject *m;

Py_SET_TYPE(&SHA224type, &PyType_Type);
if (PyType_Ready(&SHA224type) < 0) {
return NULL;
}
Py_SET_TYPE(&SHA256type, &PyType_Type);
if (PyType_Ready(&SHA256type) < 0) {
return NULL;
}

m = PyModule_Create(&_sha256module);
if (m == NULL)
return NULL;

Py_INCREF((PyObject *)&SHA224type);
PyModule_AddObject(m, "SHA224Type", (PyObject *)&SHA224type);
Py_INCREF((PyObject *)&SHA256type);
PyModule_AddObject(m, "SHA256Type", (PyObject *)&SHA256type);
return m;

}
Toggle all file notes Toggle all file annotations