0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
keysz_pymembers, /* @tp_members@ */
0, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
0, /* @tp_members@ */
keyszany_pygetset, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
keyszrange_pymembers, /* @tp_members@ */
0, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
keyszset_pymembers, /* @tp_members@ */
keyszset_pygetset, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
0, /* @tp_members@ */
gccipher_pygetset, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
gcipher_pymethods, /* @tp_methods@ */
0, /* @tp_members@ */
0, /* @tp_getset@ */
{ 0 }
};
+#define GHMETH_HASHU_(n, W, w) \
+ static PyObject *ghmeth_hashu##w(PyObject *me, PyObject *arg) \
+ { \
+ uint##n x; \
+ if (!PyArg_ParseTuple(arg, "O&:hashu" #w, convu##n, &x)) goto end; \
+ GH_HASHU##W(GHASH_H(me), x); \
+ RETURN_ME; \
+ end: \
+ return (0); \
+ }
+DOUINTCONV(GHMETH_HASHU_)
+
+#define GHMETH_HASHBUF_(n, W, w) \
+ static PyObject *ghmeth_hashbuf##w(PyObject *me, PyObject *arg) \
+ { \
+ char *p; \
+ int sz; \
+ if (!PyArg_ParseTuple(arg, "s#:hashbuf" #w, &p, &sz)) goto end; \
+ if (sz > MASK##n) TYERR("string too long"); \
+ GH_HASHBUF##W(GHASH_H(me), p, sz); \
+ RETURN_ME; \
+ end: \
+ return (0); \
+ }
+DOUINTCONV(GHMETH_HASHBUF_)
+
+static PyObject *ghmeth_hashstrz(PyObject *me, PyObject *arg)
+{
+ char *p;
+ if (!PyArg_ParseTuple(arg, "s:hashstrz", &p)) return (0);
+ GH_HASHSTRZ(GHASH_H(me), p);
+ RETURN_ME;
+}
+
static PyMethodDef ghash_pymethods[] = {
#define METHNAME(name) ghmeth_##name
METH (hash, "H.hash(M)")
+#define METHU_(n, W, w) METH(hashu##w, "H.hashu" #w "(WORD)")
+ DOUINTCONV(METHU_)
+#define METHBUF_(n, W, w) METH(hashbuf##w, "H.hashbuf" #w "(BYTES)")
+ DOUINTCONV(METHBUF_)
+ METH (hashstrz, "H.hashstrz(STRING)")
METH (done, "H.done() -> HASH")
#undef METHNAME
{ 0 }
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
0, /* @tp_members@ */
gchash_pygetset, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
ghash_pymethods, /* @tp_methods@ */
0, /* @tp_members@ */
0, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
0, /* @tp_members@ */
gcmac_pygetset, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
0, /* @tp_members@ */
0, /* @tp_getset@ */
0, /* @tp_richcompare@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
- 0, /* @tp_iternexr@ */
+ 0, /* @tp_iternext@ */
0, /* @tp_methods@ */
0, /* @tp_members@ */
0, /* @tp_getset@ */