mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 17:52:02 +02:00
Expose reset as well
This commit is contained in:
@@ -175,6 +175,12 @@ Hasher_dealloc(PyObject *self) {
|
|||||||
Py_TYPE(self)->tp_free(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*
|
static PyObject*
|
||||||
update(Hasher *self, PyObject *o) {
|
update(Hasher *self, PyObject *o) {
|
||||||
FREE_BUFFER_AFTER_FUNCTION Py_buffer data = {0};
|
FREE_BUFFER_AFTER_FUNCTION Py_buffer data = {0};
|
||||||
@@ -217,6 +223,7 @@ static PyMethodDef Hasher_methods[] = {
|
|||||||
METHODB(update, METH_O),
|
METHODB(update, METH_O),
|
||||||
METHODB(digest, METH_NOARGS),
|
METHODB(digest, METH_NOARGS),
|
||||||
METHODB(hexdigest, METH_NOARGS),
|
METHODB(hexdigest, METH_NOARGS),
|
||||||
|
METHODB(reset, METH_NOARGS),
|
||||||
{NULL} /* Sentinel */
|
{NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
from typing import Union
|
||||||
|
|
||||||
|
Buffer = Union[bytes, bytearray, memoryview]
|
||||||
|
|
||||||
class RsyncError(Exception):
|
class RsyncError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class Hasher:
|
||||||
|
def __init__(self, which: str, data: Buffer = b''): ...
|
||||||
|
def update(self, data: Buffer) -> None: ...
|
||||||
|
def reset(self) -> None: ...
|
||||||
|
def digest(self) -> bytes: ...
|
||||||
|
def hexdigest(self) -> str: ...
|
||||||
|
|
||||||
|
@property
|
||||||
|
def digest_size(self) -> int: ...
|
||||||
|
@property
|
||||||
|
def block_size(self) -> int: ...
|
||||||
|
@property
|
||||||
|
def name(self) -> str: ...
|
||||||
|
|||||||
Reference in New Issue
Block a user