mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 06:25:13 +02:00
Add tests for the xxhash based hashers
This commit is contained in:
@@ -290,6 +290,13 @@ digest(Hasher *self, PyObject *args UNUSED) {
|
||||
return ans;
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
digest64(Hasher *self, PyObject *args UNUSED) {
|
||||
if (self->h.digest64 == NULL) { PyErr_SetString(PyExc_TypeError, "Does not support 64-bit digests"); return NULL; }
|
||||
unsigned long long a = self->h.digest64(self->h.state);
|
||||
return PyLong_FromUnsignedLongLong(a);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
hexdigest(Hasher *self, PyObject *args UNUSED) {
|
||||
uint8_t digest[64]; char hexdigest[128];
|
||||
@@ -314,6 +321,7 @@ Hasher_name(Hasher* self, void* closure UNUSED) { return PyUnicode_FromString(se
|
||||
static PyMethodDef Hasher_methods[] = {
|
||||
METHODB(update, METH_O),
|
||||
METHODB(digest, METH_NOARGS),
|
||||
METHODB(digest64, METH_NOARGS),
|
||||
METHODB(hexdigest, METH_NOARGS),
|
||||
METHODB(reset, METH_NOARGS),
|
||||
{NULL} /* Sentinel */
|
||||
|
||||
Reference in New Issue
Block a user