#ifndef Py_BUILD_CORE_BUILTIN
#define Py_BUILD_CORE_MODULE …
#endif
#include "Python.h"
#include "pycore_strhex.h"
#include "pycore_typeobject.h"
#include "hashlib.h"
#define SHA3_MAX_DIGESTSIZE …
SHA3State;
static inline SHA3State*
sha3_get_state(PyObject *module)
{ … }
#include "_hacl/Hacl_Hash_SHA3.h"
SHA3object;
#include "clinic/sha3module.c.h"
static SHA3object *
newSHA3object(PyTypeObject *type)
{ … }
static void sha3_update(Hacl_Hash_SHA3_state_t *state, uint8_t *buf, Py_ssize_t len) { … }
static PyObject *
py_sha3_new_impl(PyTypeObject *type, PyObject *data, int usedforsecurity)
{ … }
static void
SHA3_dealloc(SHA3object *self)
{ … }
static PyObject *
_sha3_sha3_224_copy_impl(SHA3object *self)
{ … }
static PyObject *
_sha3_sha3_224_digest_impl(SHA3object *self)
{ … }
static PyObject *
_sha3_sha3_224_hexdigest_impl(SHA3object *self)
{ … }
static PyObject *
_sha3_sha3_224_update(SHA3object *self, PyObject *data)
{ … }
static PyMethodDef SHA3_methods[] = …;
static PyObject *
SHA3_get_block_size(SHA3object *self, void *closure)
{ … }
static PyObject *
SHA3_get_name(SHA3object *self, void *closure)
{ … }
static PyObject *
SHA3_get_digest_size(SHA3object *self, void *closure)
{ … }
static PyObject *
SHA3_get_capacity_bits(SHA3object *self, void *closure)
{ … }
static PyObject *
SHA3_get_rate_bits(SHA3object *self, void *closure)
{ … }
static PyObject *
SHA3_get_suffix(SHA3object *self, void *closure)
{ … }
static PyGetSetDef SHA3_getseters[] = …;
#define SHA3_TYPE_SLOTS(type_slots_obj, type_doc, type_methods, type_getseters) …
#define SHA3_TYPE_SPEC(type_spec_obj, type_name, type_slots) …
PyDoc_STRVAR(sha3_224__doc__,
"sha3_224([data], *, usedforsecurity=True) -> SHA3 object\n\
\n\
Return a new SHA3 hash object with a hashbit length of 28 bytes.");
PyDoc_STRVAR(sha3_256__doc__,
"sha3_256([data], *, usedforsecurity=True) -> SHA3 object\n\
\n\
Return a new SHA3 hash object with a hashbit length of 32 bytes.");
PyDoc_STRVAR(sha3_384__doc__,
"sha3_384([data], *, usedforsecurity=True) -> SHA3 object\n\
\n\
Return a new SHA3 hash object with a hashbit length of 48 bytes.");
PyDoc_STRVAR(sha3_512__doc__,
"sha3_512([data], *, usedforsecurity=True) -> SHA3 object\n\
\n\
Return a new SHA3 hash object with a hashbit length of 64 bytes.");
SHA3_TYPE_SLOTS(sha3_224_slots, sha3_224__doc__, SHA3_methods, SHA3_getseters);
SHA3_TYPE_SPEC(…) …;
SHA3_TYPE_SLOTS(sha3_256_slots, sha3_256__doc__, SHA3_methods, SHA3_getseters);
SHA3_TYPE_SPEC(…) …;
SHA3_TYPE_SLOTS(sha3_384_slots, sha3_384__doc__, SHA3_methods, SHA3_getseters);
SHA3_TYPE_SPEC(…) …;
SHA3_TYPE_SLOTS(sha3_512_slots, sha3_512__doc__, SHA3_methods, SHA3_getseters);
SHA3_TYPE_SPEC(…) …;
static PyObject *
_SHAKE_digest(SHA3object *self, unsigned long digestlen, int hex)
{ … }
static PyObject *
_sha3_shake_128_digest_impl(SHA3object *self, unsigned long length)
{ … }
static PyObject *
_sha3_shake_128_hexdigest_impl(SHA3object *self, unsigned long length)
{ … }
static PyObject *
SHAKE_get_digest_size(SHA3object *self, void *closure)
{ … }
static PyObject *
SHAKE_get_suffix(SHA3object *self, void *closure)
{ … }
static PyGetSetDef SHAKE_getseters[] = …;
static PyMethodDef SHAKE_methods[] = …;
PyDoc_STRVAR(shake_128__doc__,
"shake_128([data], *, usedforsecurity=True) -> SHAKE object\n\
\n\
Return a new SHAKE hash object.");
PyDoc_STRVAR(shake_256__doc__,
"shake_256([data], *, usedforsecurity=True) -> SHAKE object\n\
\n\
Return a new SHAKE hash object.");
SHA3_TYPE_SLOTS(SHAKE128slots, shake_128__doc__, SHAKE_methods, SHAKE_getseters);
SHA3_TYPE_SPEC(…) …;
SHA3_TYPE_SLOTS(SHAKE256slots, shake_256__doc__, SHAKE_methods, SHAKE_getseters);
SHA3_TYPE_SPEC(…) …;
static int
_sha3_traverse(PyObject *module, visitproc visit, void *arg)
{ … }
static int
_sha3_clear(PyObject *module)
{ … }
static void
_sha3_free(void *module)
{ … }
static int
_sha3_exec(PyObject *m)
{ … }
static PyModuleDef_Slot _sha3_slots[] = …;
static struct PyModuleDef _sha3module = …;
PyMODINIT_FUNC
PyInit__sha3(void)
{ … }