Expose reset as well

This commit is contained in:
Kovid Goyal 2023-07-14 15:52:38 +05:30
parent fabb6bd8cc
commit 562f09c1f6
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 24 additions and 0 deletions

View file

@ -175,6 +175,12 @@ Hasher_dealloc(PyObject *self) {
Py_TYPE(self)->tp_free(self);
}
static PyObject*
reset(Hasher *self) {
if (!self->h.reset(self->h.state)) return PyErr_NoMemory();
Py_RETURN_NONE;
}
static PyObject*
update(Hasher *self, PyObject *o) {
FREE_BUFFER_AFTER_FUNCTION Py_buffer data = {0};
@ -217,6 +223,7 @@ static PyMethodDef Hasher_methods[] = {
METHODB(update, METH_O),
METHODB(digest, METH_NOARGS),
METHODB(hexdigest, METH_NOARGS),
METHODB(reset, METH_NOARGS),
{NULL} /* Sentinel */
};