static PyTypeObject keysz_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.KeySZ", /* @tp_name@ */
+ "KeySZ", /* @tp_name@ */
sizeof(keysz_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject keyszany_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.KeySZAny", /* @tp_name@ */
+ "KeySZAny", /* @tp_name@ */
sizeof(keysz_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject keyszrange_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.KeySZRange", /* @tp_name@ */
+ "KeySZRange", /* @tp_name@ */
sizeof(keyszrange_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject keyszset_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.KeySZSet", /* @tp_name@ */
+ "KeySZSet", /* @tp_name@ */
sizeof(keyszset_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
g->ty.ht_type.tp_alloc = PyType_GenericAlloc;
g->ty.ht_type.tp_free = 0;
g->ty.ht_type.tp_new = gcipher_pynew;
- PyType_Ready(&g->ty.ht_type);
+ typeready(&g->ty.ht_type);
return ((PyObject *)g);
}
static PyTypeObject gccipher_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GCCipher", /* @tp_name@ */
+ "GCCipher", /* @tp_name@ */
sizeof(gccipher_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject gcipher_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GCipher", /* @tp_name@ */
+ "GCipher", /* @tp_name@ */
sizeof(gcipher_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
g->ty.ht_type.tp_alloc = PyType_GenericAlloc;
g->ty.ht_type.tp_free = 0;
g->ty.ht_type.tp_new = ghash_pynew;
- PyType_Ready(&g->ty.ht_type);
+ typeready(&g->ty.ht_type);
return ((PyObject *)g);
}
RETURN_ME;
}
-static PyObject *ghmeth_done(PyObject *me, PyObject *arg)
-{
- ghash *g;
- PyObject *rc;
- if (!PyArg_ParseTuple(arg, ":done")) return (0);
- g = GH_COPY(GHASH_H(me));
- rc = bytestring_pywrap(0, g->ops->c->hashsz);
- GH_DONE(g, PyString_AS_STRING(rc));
- GH_DESTROY(g);
- return (rc);
-}
-
-static PyGetSetDef gchash_pygetset[] = {
-#define GETSETNAME(op, name) gch##op##_##name
- GET (bufsz, "CH.bufsz -> hash buffer size, or zero")
- GET (hashsz, "CH.blksz -> hash output size")
- GET (name, "CH.name -> name of this kind of hash")
-#undef GETSETNAME
- { 0 }
-};
-
#define GHMETH_HASHU_(n, W, w) \
static PyObject *ghmeth_hashu##w(PyObject *me, PyObject *arg) \
{ \
RETURN_ME;
}
+static PyObject *ghmeth_done(PyObject *me, PyObject *arg)
+{
+ ghash *g;
+ PyObject *rc;
+ if (!PyArg_ParseTuple(arg, ":done")) return (0);
+ g = GH_COPY(GHASH_H(me));
+ rc = bytestring_pywrap(0, g->ops->c->hashsz);
+ GH_DONE(g, PyString_AS_STRING(rc));
+ GH_DESTROY(g);
+ return (rc);
+}
+
+static PyGetSetDef gchash_pygetset[] = {
+#define GETSETNAME(op, name) gch##op##_##name
+ GET (bufsz, "CH.bufsz -> hash buffer size, or zero")
+ GET (hashsz, "CH.hashsz -> hash output size")
+ GET (name, "CH.name -> name of this kind of hash")
+#undef GETSETNAME
+ { 0 }
+};
+
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_)
+#undef METHU_
#define METHBUF_(n, W, w) METH(hashbuf##w, "H.hashbuf" #w "(BYTES)")
DOUINTCONV(METHBUF_)
+#undef METHBUF_
METH (hashstrz, "H.hashstrz(STRING)")
METH (done, "H.done() -> HASH")
#undef METHNAME
static PyTypeObject gchash_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GCHash", /* @tp_name@ */
+ "GCHash", /* @tp_name@ */
sizeof(gchash_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject ghash_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GHash", /* @tp_name@ */
+ "GHash", /* @tp_name@ */
sizeof(ghash_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
g->ty.ht_type.tp_alloc = PyType_GenericAlloc;
g->ty.ht_type.tp_free = 0;
g->ty.ht_type.tp_new = gmac_pynew;
- PyType_Ready(&g->ty.ht_type);
+ typeready(&g->ty.ht_type);
return ((PyObject *)g);
}
if (!cobj) cobj = gcmac_pywrap((/*unconst*/ gcmac *)GM_CLASS(m));
else Py_INCREF(cobj);
g = newtype((PyTypeObject *)cobj, 0, 0);
+ g->ty.ht_type.tp_basicsize = sizeof(ghash_pyobj);
g->ty.ht_name = PyString_FromFormat("%s(keyed)", m->ops->c->name);
g->ty.ht_type.tp_name = PyString_AS_STRING(g->ty.ht_name);
g->ty.ht_type.tp_base = gmhash_pytype;
g->ty.ht_type.tp_alloc = PyType_GenericAlloc;
g->ty.ht_type.tp_free = 0;
g->ty.ht_type.tp_new = gmhash_pynew;
- PyType_Ready(&g->ty.ht_type);
+ typeready(&g->ty.ht_type);
g->m = m;
g->f = f;
return ((PyObject *)g);
static PyTypeObject gcmac_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GCMAC", /* @tp_name@ */
+ "GCMAC", /* @tp_name@ */
sizeof(gchash_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject gmac_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GMAC", /* @tp_name@ */
+ "GMAC", /* @tp_name@ */
sizeof(gmac_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject gmhash_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GMACHash", /* @tp_name@ */
+ "GMACHash", /* @tp_name@ */
sizeof(ghash_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
g->ty.ht_type.tp_alloc = PyType_GenericAlloc;
g->ty.ht_type.tp_free = 0;
g->ty.ht_type.tp_new = gprp_pynew;
- PyType_Ready(&g->ty.ht_type);
+ typeready(&g->ty.ht_type);
return ((PyObject *)g);
}
static PyTypeObject gcprp_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GCPRP", /* @tp_name@ */
+ "GCPRP", /* @tp_name@ */
sizeof(gcprp_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */
static PyTypeObject gprp_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
- "catacomb.GPRP", /* @tp_name@ */
+ "GPRP", /* @tp_name@ */
sizeof(gprp_pyobj), /* @tp_basicsize@ */
0, /* @tp_itemsize@ */