0 /* @tp_is_gc@ */
};
+/*----- Special snowflake for HSalsa and HChaCha --------------------------*/
+
+#define DEF_HDANCE(DANCE, HDANCE, dance, hdance) \
+ static PyObject *meth_##hdance##_prf(PyObject *me, PyObject *arg) \
+ { \
+ dance##_ctx dance; \
+ char *k, *n; \
+ int ksz, nsz; \
+ PyObject *rc; \
+ if (!PyArg_ParseTuple(arg, "s#s#:" #hdance "_prf", \
+ &k, &ksz, &n, &nsz)) \
+ goto end; \
+ if (ksz != DANCE##_KEYSZ) VALERR("bad key length"); \
+ if (nsz != HDANCE##_INSZ) VALERR("bad input length"); \
+ rc = bytestring_pywrap(0, HSALSA20_OUTSZ); \
+ dance##_init(&dance, k, ksz, 0); \
+ hdance##_prf(&dance, n, PyString_AS_STRING(rc)); \
+ return (rc); \
+ end: \
+ return (0); \
+ }
+
+DEF_HDANCE(SALSA20, HSALSA20, salsa20, hsalsa20)
+DEF_HDANCE(SALSA20, HSALSA20, salsa20, hsalsa2012)
+DEF_HDANCE(SALSA20, HSALSA20, salsa20, hsalsa208)
+
+DEF_HDANCE(CHACHA, HCHACHA, chacha, hchacha20)
+DEF_HDANCE(CHACHA, HCHACHA, chacha, hchacha12)
+DEF_HDANCE(CHACHA, HCHACHA, chacha, hchacha8)
/*----- Pseudorandom permutations -----------------------------------------*/
toif(N) -> M: convert work factor to integer factorization problem size")
METH (_KeySZ_toec, "\
toec(N) -> M: convert work factor to elliptic curve group order")
+ METH (_KeySZ_toec, "\
+toec(N) -> M: convert work factor to elliptic curve group order")
+#define METH_HDANCE(hdance, HDance) METH(hdance##_prf, "\
+" #hdance "_prf(K, N) -> H: calculate " HDance " hash of N with K")
+ METH_HDANCE(hsalsa20, "HSalsa20")
+ METH_HDANCE(hsalsa2012, "HSalsa20/12")
+ METH_HDANCE(hsalsa208, "HSalsa20/8")
+ METH_HDANCE(hchacha20, "HChaCha20")
+ METH_HDANCE(hchacha12, "HChaCha12")
+ METH_HDANCE(hchacha8, "HChaCha8")
+#undef METH_DANCE
#undef METHNAME
{ 0 }
};