};
#define KSZCONVOP(op) \
- static PyObject *meth__KeySZ_##op(PyObject *me, PyObject *arg) \
+ static PyObject *kszmeth_##op(PyObject *me, PyObject *arg) \
{ \
double x, y; \
- if (!PyArg_ParseTuple(arg, "Od:" #op, &me, &x)) return (0); \
+ if (!PyArg_ParseTuple(arg, "d:" #op, &x)) return (0); \
y = keysz_##op(x); \
return (PyFloat_FromDouble(y)); \
}
KSZCONVOP(toec)
#undef KSZCONVOP
+static const PyMethodDef keysz_pymethods[] = {
+#define METHNAME(name) kszmeth_##name
+ SMTH (fromdl, "fromdl(N) -> M: "
+ "convert integer discrete log field size to work factor")
+ SMTH (fromschnorr, "fromschnorr(N) -> M: "
+ "convert Schnorr group order to work factor")
+ SMTH (fromif, "fromif(N) -> M: "
+ "convert integer factorization problem size to work factor")
+ SMTH (fromec, "fromec(N) -> M: "
+ "convert elliptic curve group order to work factor")
+ SMTH (todl, "todl(N) -> M: "
+ "convert work factor to integer discrete log field size")
+ SMTH (toschnorr, "toschnorr(N) -> M: "
+ "convert work factor to Schnorr group order")
+ SMTH (toif, "toif(N) -> M: "
+ "convert work factor to integer factorization problem size")
+ SMTH (toec, "toec(N) -> M: "
+ "convert work factor to elliptic curve group order")
+ SMTH (toec, "toec(N) -> M: "
+ "convert work factor to elliptic curve group order")
+#undef METHNAME
+ { 0 }
+};
+
static const PyGetSetDef keyszany_pygetset[] = {
#define GETSETNAME(op, name) ka##op##_##name
GET (min, "KSZ.min -> smallest allowed key size")
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
0, /* @tp_iternext@ */
- 0, /* @tp_methods@ */
+ PYMETHODS(keysz), /* @tp_methods@ */
PYMEMBERS(keysz), /* @tp_members@ */
0, /* @tp_getset@ */
0, /* @tp_base@ */
static const PyMethodDef methods[] = {
#define METHNAME(func) meth_##func
- METH (_KeySZ_fromdl, "fromdl(N) -> M: "
- "convert integer discrete log field size to work factor")
- METH (_KeySZ_fromschnorr, "fromschnorr(N) -> M: "
- "convert Schnorr group order to work factor")
- METH (_KeySZ_fromif, "fromif(N) -> M: "
- "convert integer factorization problem size to work factor")
- METH (_KeySZ_fromec, "fromec(N) -> M: "
- "convert elliptic curve group order to work factor")
- METH (_KeySZ_todl, "todl(N) -> M: "
- "convert work factor to integer discrete log field size")
- METH (_KeySZ_toschnorr, "toschnorr(N) -> M: "
- "convert work factor to Schnorr group order")
- METH (_KeySZ_toif, "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")
return (0);
}
-static PyObject *meth__ByteString_zero(PyObject *me, PyObject *arg)
+static PyObject *bymeth_zero(PyObject *me, PyObject *arg)
{
size_t sz;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "OO&:zero", &me, convszt, &sz)) goto end;
+ if (!PyArg_ParseTuple(arg, "O&:zero", convszt, &sz)) goto end;
rc = bytestring_pywrap(0, sz);
memset(PyString_AS_STRING(rc), 0, sz);
end:
}
UNOP(not, ~)
+static const PyMethodDef bytestring_pymethods[] = {
+#define METHNAME(name) bymeth_##name
+ SMTH (zero, "zero(N) -> 0000...00")
+#undef METHNAME
+ { 0 }
+};
+
static const PyNumberMethods bytestring_pynumber = {
0, /* @nb_add@ */
0, /* @nb_subtract@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
0, /* @tp_iternext@ */
- 0, /* @tp_methods@ */
+ PYMETHODS(bytestring), /* @tp_methods@ */
0, /* @tp_members@ */
0, /* @tp_getset@ */
0, /* @tp_base@ */
static const PyMethodDef methods[] = {
#define METHNAME(func) meth_##func
METH (ctstreq, "ctstreq(S, T) -> BOOL")
- METH (_ByteString_zero, "zero(N) -> 0000...00")
#undef METHNAME
{ 0 }
};
for i in b:
if i[0] != '_':
d[i] = b[i];
- for i in ['ByteString',
- 'MP', 'GF', 'Field',
- 'ECPt', 'ECPtCurve', 'ECCurve', 'ECInfo',
- 'DHInfo', 'BinDHInfo', 'RSAPriv', 'BBSPriv',
- 'PrimeFilter', 'RabinMiller',
- 'Group', 'GE',
- 'KeySZ', 'KeyData']:
- c = d[i]
- pre = '_' + i + '_'
- plen = len(pre)
- for j in b:
- if j[:plen] == pre:
- setattr(c, j[plen:], classmethod(b[j]))
for i in [gcciphers, gcaeads, gchashes, gcmacs, gcprps]:
for c in i.itervalues():
d[_fixname(c.name)] = c
static PyObject *epget_curve(PyObject *me, void *hunoz)
{ RETURN_OBJ(ECPT_COBJ(me)); }
-static PyObject *meth__ECPt_frombuf(PyObject *me, PyObject *arg)
+static PyObject *epmeth_frombuf(PyObject *me, PyObject *arg)
{
buf b;
char *p;
PyObject *rc = 0;
ec pp = EC_INIT;
- if (!PyArg_ParseTuple(arg, "Os#:frombuf", &me, &p, &sz)) goto end;
+ if (!PyArg_ParseTuple(arg, "s#:frombuf", &p, &sz)) goto end;
buf_init(&b, p, sz);
if (buf_getec(&b, &pp)) VALERR("malformed data");
rc = Py_BuildValue("(NN)", ecpt_pywrapout(me, &pp),
return (rc);
}
-static PyObject *meth__ECPt_parse(PyObject *me, PyObject *arg)
+static PyObject *epmeth_parse(PyObject *me, PyObject *arg)
{
char *p;
qd_parse qd;
PyObject *rc = 0;
ec pp = EC_INIT;
- if (!PyArg_ParseTuple(arg, "Os:parse", &me, &p)) goto end;
+ if (!PyArg_ParseTuple(arg, "s:parse", &p)) goto end;
qd.p = p; qd.e = 0;
if (!ec_ptparse(&qd, &pp)) VALERR(qd.e);
rc = Py_BuildValue("(Ns)", ecpt_pywrapout(me, &pp), qd.p);
return (rc);
}
-static PyObject *meth__ECPtCurve_fromraw(PyObject *me, PyObject *arg)
+static PyObject *epmeth_fromraw(PyObject *me, PyObject *arg)
{
char *p;
Py_ssize_t len;
ec_curve *cc;
ec pp = EC_INIT;
- if (!PyArg_ParseTuple(arg, "Os#:fromraw", &me, &p, &len))
- return (0);
+ if (!PyArg_ParseTuple(arg, "s#:fromraw", &me, &p, &len)) return (0);
buf_init(&b, p, len);
cc = ECCURVE_C(me);
if (ec_getraw(cc, &b, &pp))
return (rc);
}
-static PyObject *meth__ECPtCurve_os2ecp(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *epmeth_os2ecp(PyObject *me, PyObject *arg, PyObject *kw)
{
char *p;
Py_ssize_t len;
ec_curve *cc;
unsigned f = EC_XONLY | EC_LSB | EC_SORT | EC_EXPLY;
ec pp = EC_INIT;
- static const char *const kwlist[] = { "class", "buf", "flags", 0 };
+ static const char *const kwlist[] = { "buf", "flags", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|O&:os2ecp", KWLIST,
- &me, &p, &len, convuint, &f))
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#|O&:os2ecp", KWLIST,
+ &p, &len, convuint, &f))
return (0);
buf_init(&b, p, len);
cc = ECCURVE_C(me);
static const PyMethodDef ecptnc_pymethods[] = {
#define METHNAME(func) epmeth_##func
METH (tobuf, "X.tobuf() -> BIN")
+ CMTH (frombuf, "frombuf(STR) -> (P, REST)")
+ CMTH (parse, "parse(STR) -> (P, REST)")
#undef METHNAME
{ 0 }
};
KWMETH(ec2osp, "X.ec2osp([flags = EC_EXPLY]) -> BIN")
METH (dbl, "X.dbl() -> X + X")
METH (oncurvep, "X.oncurvep() -> BOOL")
+ CMTH (fromraw, "fromraw(STR) -> (P, REST)")
+ KWCMTH(os2ecp, "os2ecp(STR, [flags = ...]) -> (P, REST)")
#undef METHNAME
{ 0 }
};
return (ecpt_pywrap(me, &p));
}
-static PyObject *meth__ECCurve_parse(PyObject *me, PyObject *arg)
+static PyObject *ecmeth_parse(PyObject *me, PyObject *arg)
{
char *p;
qd_parse qd;
ec_curve *c;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "Os:parse", &me, &p)) goto end;
+ if (!PyArg_ParseTuple(arg, "s:parse", &p)) goto end;
qd.p = p; qd.e = 0;
if ((c = ec_curveparse(&qd)) == 0) VALERR(qd.e);
rc = eccurve_pywrap(0, c);
METH (mmul, "E.mmul([(P0, N0), (P1, N1), ...]) = N0 P0 + N1 P1 + ...")
METH (find, "E.find(X) -> P")
KWMETH(rand, "E.rand([rng = rand]) -> P")
+ SMTH (parse, "parse(STR) -> (E, REST)")
#undef METHNAME
{ 0 }
};
return (0);
}
-static PyObject *meth__ECInfo_parse(PyObject *me, PyObject *arg)
+static PyObject *eimeth_parse(PyObject *me, PyObject *arg)
{
char *p;
qd_parse qd;
ec_info ei;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "Os:parse", &me, &p)) goto end;
+ if (!PyArg_ParseTuple(arg, "s:parse", &p)) goto end;
qd.p = p; qd.e = 0;
if (ec_infoparse(&qd, &ei)) VALERR(qd.e);
rc = Py_BuildValue("(Ns)", ecinfo_pywrap(&ei), qd.p);
return (rc);
}
-static PyObject *meth__ECInfo__curven(PyObject *me, PyObject *arg)
+static PyObject *eimeth__curven(PyObject *me, PyObject *arg)
{
int i;
ec_info ei;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "Oi:_curven", &me, &i)) goto end;
+ if (!PyArg_ParseTuple(arg, "i:_curven", &i)) goto end;
if (i < 0 || i >= ncurves) VALERR("curve index out of range");
ec_infofromdata(&ei, ectab[i].data);
rc = ecinfo_pywrap(&ei);
static const PyMethodDef ecinfo_pymethods[] = {
#define METHNAME(name) eimeth_##name
KWMETH(check, "I.check([rng = rand]) -> None")
+ SMTH (parse, "parse(STR) -> (I, REST)")
+ SMTH (_curven, "_curven(N) -> I")
#undef METHNAME
{ 0 }
};
/*----- Setup -------------------------------------------------------------*/
-static const PyMethodDef methods[] = {
-#define METHNAME(func) meth_##func
- METH (_ECPt_frombuf, "frombuf(E, STR) -> (P, REST)")
- METH (_ECPtCurve_fromraw, "fromraw(E, STR) -> (P, REST)")
- KWMETH(_ECPtCurve_os2ecp, "os2ecp(E, STR, [flags = ...]) -> (P, REST)")
- METH (_ECPt_parse, "parse(E, STR) -> (P, REST)")
- METH (_ECCurve_parse, "parse(STR) -> (E, REST)")
- METH (_ECInfo_parse, "parse(STR) -> (I, REST)")
- METH (_ECInfo__curven, "_curven(N) -> I")
-#undef METHNAME
- { 0 }
-};
-
void ec_pyinit(void)
{
INITTYPE(ecpt, root);
INITTYPE(ecbincurve, eccurve);
INITTYPE(ecbinprojcurve, ecbincurve);
INITTYPE(ecinfo, root);
- addmethods(methods);
}
static PyObject *namedcurves(void)
return (fe_pywrap(me, xx));
}
-static PyObject *meth__Field_parse(PyObject *me, PyObject *arg)
+static PyObject *fmeth_parse(PyObject *me, PyObject *arg)
{
field *f;
char *p;
PyObject *rc = 0;
qd_parse qd;
- if (!PyArg_ParseTuple(arg, "Os:parse", &me, &p)) goto end;
+ if (!PyArg_ParseTuple(arg, "s:parse", &p)) goto end;
qd.p = p; qd.e = 0;
if ((f = field_parse(&qd)) == 0) VALERR(qd.e);
rc = Py_BuildValue("(Ns)", field_pywrap(f), qd.p);
#define METHNAME(name) fmeth_##name
METH (_adopt, "F._adopt(X) -> FE")
KWMETH(rand, "F.rand([rng = rand]) -> FE, uniformly distributed")
+ SMTH (parse, "parse(STR) -> F, REST")
#undef METHNAME
{ 0 }
};
/*----- Setup -------------------------------------------------------------*/
-static const PyMethodDef methods[] = {
-#define METHNAME(func) meth_##func
- METH (_Field_parse, "parse(STR) -> F, REST")
-#undef METHNAME
- { 0 }
-};
-
void field_pyinit(void)
{
INITTYPE(fe, root);
INITTYPE(binfield, field);
INITTYPE(binpolyfield, binfield);
INITTYPE(binnormfield, binfield);
- addmethods(methods);
}
void field_pyinsert(PyObject *mod)
FREEOBJ(me);
}
-static PyObject *meth__DHInfo_generate(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *dimeth_generate(PyObject *me, PyObject *arg, PyObject *kw)
{
dh_param dp;
unsigned ql = 0, pl;
struct excinfo exc = EXCINFO_INIT;
pypgev evt = { { 0 } };
static const char *const kwlist[] =
- { "class", "pbits", "qbits", "event", "rng", "nsteps", 0 };
+ { "pbits", "qbits", "event", "rng", "nsteps", 0 };
PyObject *rc = 0;
evt.exc = &exc;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", KWLIST,
- &me, convuint, &pl, convuint, &ql,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|O&O&O&O&:generate", KWLIST,
+ convuint, &pl, convuint, &ql,
convpgev, &evt, convgrand, &r,
convuint, &steps))
goto end;
return (rc);
}
-static PyObject *meth__DHInfo_genlimlee(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *dimeth_genlimlee(PyObject *me, PyObject *arg, PyObject *kw)
{
dh_param dp;
unsigned ql, pl;
int subgroupp = 1;
unsigned f = 0;
static const char *const kwlist[] = {
- "class", "pbits", "qbits", "event", "ievent",
+ "pbits", "qbits", "event", "ievent",
"rng", "nsteps", "subgroupp", 0
};
size_t i, nf;
oe.exc = ie.exc = &exc;
if (!PyArg_ParseTupleAndKeywords(arg, kw,
- "OO&O&|O&O&O&O&O&:genlimlee", KWLIST,
- &me, convuint, &pl, convuint, &ql,
+ "O&O&|O&O&O&O&O&:genlimlee", KWLIST,
+ convuint, &pl, convuint, &ql,
convpgev, &oe, convpgev, &ie,
convgrand, &r, convuint, &steps,
convbool, &subgroupp))
return (rc);
}
-static PyObject *meth__DHInfo_genkcdsa(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *dimeth_genkcdsa(PyObject *me, PyObject *arg, PyObject *kw)
{
dh_param dp;
unsigned ql, pl;
struct excinfo exc = EXCINFO_INIT;
pypgev evt = { { 0 } };
static const char *const kwlist[] =
- { "class", "pbits", "qbits", "event", "rng", "nsteps", 0 };
+ { "pbits", "qbits", "event", "rng", "nsteps", 0 };
mp *v = MP_NEW;
PyObject *rc = 0;
evt.exc = &exc;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&O&|O&O&O&:genkcdsa", KWLIST,
- &me, convuint, &pl, convuint, &ql,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|O&O&O&:genkcdsa", KWLIST,
+ convuint, &pl, convuint, &ql,
convpgev, &evt, convgrand, &r,
convuint, &steps))
goto end;
return (rc);
}
-static PyObject *meth__DHInfo_gendsa(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *dimeth_gendsa(PyObject *me, PyObject *arg, PyObject *kw)
{
dsa_param dp;
unsigned ql, pl;
struct excinfo exc = EXCINFO_INIT;
pypgev evt = { { 0 } };
static const char *const kwlist[] =
- { "class", "pbits", "qbits", "seed", "event", "nsteps", 0 };
+ { "pbits", "qbits", "seed", "event", "nsteps", 0 };
PyObject *rc = 0;
evt.exc = &exc;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&O&s#|O&O&:gendsa", KWLIST,
- &me, convuint, &pl, convuint, &ql,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&s#|O&O&:gendsa", KWLIST,
+ convuint, &pl, convuint, &ql,
&k, &ksz, convpgev, &evt,
convuint, &steps))
goto end;
gprime_param gp;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "Oi:_groupn", &me, &i)) goto end;
+ if (!PyArg_ParseTuple(arg, "i:_groupn", &i)) goto end;
if (i < 0 || i >= ne) VALERR("group index out of range");
dh_infofromdata(&gp, pp[i].data);
rc = fginfo_pywrap(&gp, ty);
return (rc);
}
-static PyObject *meth__DHInfo__groupn(PyObject *me, PyObject *arg)
+static PyObject *dimeth__groupn(PyObject *me, PyObject *arg)
{ return (meth__groupn(me, arg, dhinfo_pytype, ptab, npgroups)); }
-static PyObject *meth__BinDHInfo__groupn(PyObject *me, PyObject *arg)
+static PyObject *bimeth__groupn(PyObject *me, PyObject *arg)
{ return (meth__groupn(me, arg, bindhinfo_pytype, bintab, nbingroups)); }
static PyObject *meth__parse(PyObject *me, PyObject *arg, PyTypeObject *ty,
gprime_param gp;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "Os:parse", &me, &p)) goto end;
+ if (!PyArg_ParseTuple(arg, "s:parse", &p)) goto end;
qd.p = p; qd.e = 0;
if (parse(&qd, &gp)) VALERR(qd.e);
rc = fginfo_pywrap(&gp, ty);
return (rc);
}
-static PyObject *meth__DHInfo_parse(PyObject *me, PyObject *arg)
+static PyObject *dimeth_parse(PyObject *me, PyObject *arg)
{ return (meth__parse(me, arg, dhinfo_pytype, dh_parse)); }
-static PyObject *meth__BinDHInfo_parse(PyObject *me, PyObject *arg)
+static PyObject *bimeth_parse(PyObject *me, PyObject *arg)
{ return (meth__parse(me, arg, bindhinfo_pytype, dhbin_parse)); }
static const PyGetSetDef fginfo_pygetset[] = {
{ 0 }
};
+static const PyMethodDef dhinfo_pymethods[] = {
+#define METHNAME(name) dimeth_##name
+ SMTH (parse, "parse(STR) -> D, REST")
+ SMTH (_groupn, 0)
+ KWSMTH(generate,
+ "generate(PBITS, [qbits = 0], [event = pgen_nullev],\n"
+ " [rng = rand], [nsteps = 0]) -> D")
+ KWSMTH(genlimlee,
+ "genlimlee(PBITS, QBITS, [event = pgen_nullev], "
+ "[ievent = pgen_nullev],\n"
+ " [rng = rand], [nsteps = 0], [subgroupp = True]) "
+ "-> (D, [Q, ...])")
+ KWSMTH(gendsa,
+ "gendsa(PBITS, QBITS, SEED, [event = pgen_nullev], [nsteps = 0])\n"
+ " -> (D, SEED, COUNT)")
+ KWSMTH(genkcdsa,
+ "gendsa(PBITS, QBITS, [event = pgen_nullev], "
+ "[rng = rand], [nsteps = 0])\n"
+ " -> (D, V)")
+#undef METHNAME
+ { 0 }
+};
+
static const PyGetSetDef bindhinfo_pygetset[] = {
#define GETSETNAME(op, name) bi##op##_##name
GET (p, "I.p -> irreducible polynomial")
{ 0 }
};
+static const PyMethodDef bindhinfo_pymethods[] = {
+#define METHNAME(name) bimeth_##name
+ SMTH (parse, "parse(STR) -> D, REST")
+ SMTH (_groupn, 0)
+#undef METHNAME
+ { 0 }
+};
+
static PyTypeObject fginfo_pytype_skel = {
PyObject_HEAD_INIT(0) 0, /* Header */
"FGInfo", /* @tp_name@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
0, /* @tp_iternext@ */
- 0, /* @tp_methods@ */
+ PYMETHODS(dhinfo), /* @tp_methods@ */
0, /* @tp_members@ */
PYGETSET(dhinfo), /* @tp_getset@ */
0, /* @tp_base@ */
0, /* @tp_weaklistoffset@ */
0, /* @tp_iter@ */
0, /* @tp_iternext@ */
- 0, /* @tp_methods@ */
+ PYMETHODS(bindhinfo), /* @tp_methods@ */
0, /* @tp_members@ */
PYGETSET(bindhinfo), /* @tp_getset@ */
0, /* @tp_base@ */
return (0);
}
-static PyObject *meth__GE_frombuf(PyObject *me, PyObject *arg)
+static PyObject *gemeth_frombuf(PyObject *me, PyObject *arg)
{
buf b;
char *p;
group *g;
ge *x = 0;
- if (!PyArg_ParseTuple(arg, "Os#:frombuf", &me, &p, &n)) return (0);
+ if (!PyArg_ParseTuple(arg, "s#:frombuf", &p, &n)) return (0);
g = GROUP_G(me);
buf_init(&b, p, n);
x = G_CREATE(g);
return (0);
}
-static PyObject *meth__GE_fromraw(PyObject *me, PyObject *arg)
+static PyObject *gemeth_fromraw(PyObject *me, PyObject *arg)
{
buf b;
char *p;
group *g;
ge *x = 0;
- if (!PyArg_ParseTuple(arg, "Os#:fromraw", &me, &p, &n)) return (0);
+ if (!PyArg_ParseTuple(arg, "s#:fromraw", &p, &n)) return (0);
g = GROUP_G(me);
buf_init(&b, p, n);
x = G_CREATE(g);
return (0);
}
-static PyObject *meth__GE_fromstring(PyObject *me, PyObject *arg)
+static PyObject *gemeth_fromstring(PyObject *me, PyObject *arg)
{
mptext_stringctx sc;
char *p;
group *g;
ge *x = 0;
- if (!PyArg_ParseTuple(arg, "Os#:fromstring", &me, &p, &n)) return (0);
+ if (!PyArg_ParseTuple(arg, "s#:fromstring", &p, &n)) return (0);
sc.buf = p;
sc.lim = sc.buf + n;
g = GROUP_G(me);
return (0);
}
-static PyObject *meth__Group_parse(PyObject *me, PyObject *arg)
+static PyObject *gmeth_parse(PyObject *me, PyObject *arg)
{
char *p;
qd_parse qd;
group *g;
- if (!PyArg_ParseTuple(arg, "Os:parse", &me, &p)) goto end;
+ if (!PyArg_ParseTuple(arg, "s:parse", &p)) goto end;
qd.p = p; qd.e = 0;
if ((g = group_parse(&qd)) == 0) VALERR(qd.e);
return (group_pywrap(g));
"X converted to elliptic curve point")
METH (tobuf, "X.tobuf() -> X in buffer representation")
METH (toraw, "X.toraw() -> X in raw representation")
+ CMTH (frombuf, "frombuf(BUF) -> X, REST")
+ CMTH (fromraw, "fromraw(BUF) -> X, REST")
+ CMTH (fromstring, "fromstring(STR) -> X, REST")
#undef METHNAME
{ 0 }
};
#define METHNAME(name) gmeth_##name
METH (mexp, "G.mexp([(X0, N0), (X1, N1), ...]) -> X0^N0 X1^N1 ...")
KWMETH(checkgroup, "G.checkgroup([rng = rand]): check group is good")
+ SMTH (parse, "parse(STR) -> G, REST")
#undef METHNAME
{ 0 }
};
/*----- Global stuff ------------------------------------------------------*/
-static const PyMethodDef methods[] = {
-#define METHNAME(name) meth_##name
- METH (_GE_frombuf, "frombuf(BUF) -> X, REST")
- METH (_GE_fromraw, "fromraw(BUF) -> X, REST")
- METH (_GE_fromstring, "fromstring(STR) -> X, REST")
- METH (_Group_parse, "parse(STR) -> G, REST")
- METH (_DHInfo_parse, "parse(STR) -> D, REST")
- METH (_BinDHInfo_parse, "parse(STR) -> D, REST")
- METH (_DHInfo__groupn, 0)
- METH (_BinDHInfo__groupn, 0)
- KWMETH(_DHInfo_generate,
- "generate(PBITS, [qbits = 0, event = pgen_nullev,\n"
- " rng = rand, nsteps = 0]) -> D")
- KWMETH(_DHInfo_genlimlee,
- "genlimlee(PBITS, QBITS, [event = pgen_nullev], "
- "[ievent = pgen_nullev],\n"
- " [rng = rand], [nsteps = 0], [subgroupp = True]) "
- "-> (D, [Q, ...])")
- KWMETH(_DHInfo_gendsa,
- "gendsa(PBITS, QBITS, SEED, [event = pgen_nullev], [nsteps = 0])\n"
- " -> (D, SEED, COUNT)")
- KWMETH(_DHInfo_genkcdsa,
- "gendsa(PBITS, QBITS, [event = pgen_nullev], "
- "[rng = rand], [nsteps = 0])\n"
- " -> (D, V)")
-#undef METHNAME
- { 0 }
-};
-
void group_pyinit(void)
{
INITTYPE(fginfo, root);
INITTYPE(primegroup, group);
INITTYPE(bingroup, group);
INITTYPE(ecgroup, group);
- addmethods(methods);
}
void group_pyinsert(PyObject *mod)
return (rc);
}
-static PyObject *meth__KeyData_readflags(PyObject *me, PyObject *arg)
+static PyObject *kdmeth_readflags(PyObject *me, PyObject *arg)
{
const char *p;
char *end;
PyObject *rc = 0;
int err;
- if (!PyArg_ParseTuple(arg, "Os:key_readflags", &me, &p)) goto end;
+ if (!PyArg_ParseTuple(arg, "s:readflags", &p)) goto end;
if ((err = key_readflags(p, &end, &f, &m)) != 0) KEYERR(err);
rc = Py_BuildValue("(NNs)", getulong(f), getulong(m), end);
end:
return (rc);
}
-static PyObject *meth__KeyData_writeflags(PyObject *me, PyObject *arg)
+static PyObject *kdmeth_writeflags(PyObject *me, PyObject *arg)
{
dstr d = DSTR_INIT;
PyObject *rc;
unsigned f;
- if (!PyArg_ParseTuple(arg, "OO&:key_writeflags", &me, convuint, &f))
- return (0);
+ if (!PyArg_ParseTuple(arg, "O&:key_writeflags", convuint, &f)) return (0);
key_writeflags(f, &d);
rc = PyString_FromStringAndSize(d.buf, d.len);
dstr_destroy(&d);
return (rc);
}
-static PyObject *meth__KeyData_read(PyObject *me, PyObject *arg)
+static PyObject *kdmeth_read(PyObject *me, PyObject *arg)
{
const char *p;
char *end;
key_data *kd;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "Os:read", &me, &p)) goto end;
+ if (!PyArg_ParseTuple(arg, "s:read", &p)) goto end;
if ((kd = key_read(p, &end)) == 0) KEYERR(KERR_MALFORMED);
rc = Py_BuildValue("(Ns)", keydata_pywrap(kd), end);
end:
return (rc);
}
-static PyObject *meth__KeyData_decode(PyObject *me, PyObject *arg)
+static PyObject *kdmeth_decode(PyObject *me, PyObject *arg)
{
const char *p;
Py_ssize_t n;
key_data *kd;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "Os#:decode", &me, &p, &n)) goto end;
+ if (!PyArg_ParseTuple(arg, "s#:decode", &p, &n)) goto end;
if ((kd = key_decode(p, n)) == 0) KEYERR(KERR_MALFORMED);
rc = keydata_pywrap(kd);
end:
KWMETH(copy, "KD.copy([filter = <any>]) -> KD")
METH (plock, "KD.plock(TAG) -> ENCRYPTED-KD")
METH (lock, "KD.lock(KEY) -> ENCRYPTED-KD")
+ SMTH (readflags, "readflags(STRING) -> (FLAGS, MASK, REST)")
+ SMTH (writeflags, "writeflags(FLAGS) -> STRING")
+ SMTH (read, "read(STRING) -> (KD, REST)")
+ SMTH (decode, "decode(BYTES) -> KD")
#undef METHNAME
{ 0 }
};
0 /* @tp_is_gc@ */
};
-/*----- Global stuff ------------------------------------------------------*/
-
-static PyMethodDef methods[] = {
-#define METHNAME(func) meth_##func
- METH (_KeyData_readflags, "KeyData.readflags(STRING) "
- "-> (FLAGS, MASK, REST)")
- METH (_KeyData_writeflags, "KeyData.writeflags(FLAGS) -> STRING")
- METH (_KeyData_read, "KeyData.read(STRING) -> (KD, REST)")
- METH (_KeyData_decode, "KeyData.decode(BYTES) -> KD")
-#undef METHNAME
- { 0 }
-};
-
/*----- Initialization ----------------------------------------------------*/
void key_pyinit(void)
INITTYPE(subkeyiter, root);
INITTYPE(keyattrs, root);
INITTYPE(keyattriter, root);
- addmethods(methods);
}
void key_pyinsert(PyObject *mod)
STOREOP(storeb2c, 2c)
#undef STOREOP
-#define BUFOP(ty, pyty) \
- static PyObject *meth__##pyty##_frombuf(PyObject *me, PyObject *arg) \
+#define BUFOP(ty) \
+ static PyObject *ty##meth_frombuf(PyObject *me, PyObject *arg) \
{ \
buf b; \
char *p; \
PyObject *rc = 0; \
mp *x; \
\
- if (!PyArg_ParseTuple(arg, "Os#:frombuf", &me, &p, &sz)) goto end; \
+ if (!PyArg_ParseTuple(arg, "s#:frombuf", &p, &sz)) goto end; \
buf_init(&b, p, sz); \
if ((x = buf_getmp(&b)) == 0) VALERR("malformed data"); \
rc = Py_BuildValue("(NN)", ty##_pywrap(x), \
end: \
return (rc); \
}
-BUFOP(mp, MP)
-BUFOP(gf, GF)
+BUFOP(mp)
+BUFOP(gf)
#undef BUFOP
static PyObject *mpmeth_tobuf(PyObject *me, PyObject *arg)
return (rc);
}
-static PyObject *meth__MP_fromstring(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *mpmeth_fromstring(PyObject *me,
+ PyObject *arg, PyObject *kw)
{
int r = 0;
char *p;
PyObject *z = 0;
mp *zz;
mptext_stringctx sc;
- static const char *const kwlist[] = { "class", "x", "radix", 0 };
+ static const char *const kwlist[] = { "x", "radix", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|i:fromstring",
- KWLIST, &me, &p, &len, &r))
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#|i:fromstring", KWLIST,
+ &p, &len, &r))
goto end;
if (!good_radix_p(r, 1)) VALERR("bad radix");
sc.buf = p; sc.lim = p + len;
return (z);
}
-static PyObject *meth__MP_factorial(PyObject *me, PyObject *arg)
+static PyObject *mpmeth_factorial(PyObject *me, PyObject *arg)
{
unsigned long i;
mp *x;
- if (!PyArg_ParseTuple(arg, "OO&:factorial", &me, convulong, &i)) return (0);
+ if (!PyArg_ParseTuple(arg, "O&:factorial", convulong, &i)) return (0);
x = mp_factorial(i);
return mp_pywrap(x);
}
-static PyObject *meth__MP_fibonacci(PyObject *me, PyObject *arg)
+static PyObject *mpmeth_fibonacci(PyObject *me, PyObject *arg)
{
long i;
mp *x;
- if (!PyArg_ParseTuple(arg, "Ol:fibonacci", &me, &i)) return (0);
+ if (!PyArg_ParseTuple(arg, "l:fibonacci", &i)) return (0);
x = mp_fibonacci(i);
return mp_pywrap(x);
}
-#define LOADOP(pre, py, name) \
- static PyObject *meth__##py##_##name(PyObject *me, PyObject *arg) \
+#define LOADOP(pre, name) \
+ static PyObject *pre##meth_##name(PyObject *me, PyObject *arg) \
{ \
char *p; \
Py_ssize_t len; \
- if (!PyArg_ParseTuple(arg, "Os#:" #name, &me, &p, &len)) return (0); \
+ if (!PyArg_ParseTuple(arg, "s#:" #name, &p, &len)) return (0); \
return (pre##_pywrap(mp_##name(MP_NEW, p, len))); \
}
-LOADOP(mp, MP, loadl)
-LOADOP(mp, MP, loadb)
-LOADOP(mp, MP, loadl2c)
-LOADOP(mp, MP, loadb2c)
-LOADOP(gf, GF, loadl)
-LOADOP(gf, GF, loadb)
+LOADOP(mp, loadl)
+LOADOP(mp, loadb)
+LOADOP(mp, loadl2c)
+LOADOP(mp, loadb2c)
+LOADOP(gf, loadl)
+LOADOP(gf, loadb)
#undef LOADOP
static PyObject *mpget_nbits(PyObject *me, void *hunoz)
KWMETH(storeb2c, "X.storeb2c([len = -1]) -> "
"big-endian bytes, two's complement")
METH (tobuf, "X.tobuf() -> buffer format")
+ KWSMTH(fromstring, "fromstring(STR, [radix = 0]) -> (X, REST)\n"
+ " Parse STR as a large integer, according to RADIX. If RADIX is\n"
+ " zero, read a prefix from STR to decide radix: allow `0b' for binary,\n"
+ " `0' or `0o' for octal, `0x' for hex, or `R_' for other radix R.")
+ SMTH (factorial, "factorial(I) -> I!: compute factorial")
+ SMTH (fibonacci, "fibonacci(I) -> F(I): compute Fibonacci number")
+ SMTH (loadl, "loadl(STR) -> X: read little-endian bytes")
+ SMTH (loadb, "loadb(STR) -> X: read big-endian bytes")
+ SMTH (loadl2c, "loadl2c(STR) -> X: "
+ "read little-endian bytes, two's complement")
+ SMTH (loadb2c, "loadb2c(STR) -> X: "
+ "read big-endian bytes, two's complement")
+ SMTH (frombuf, "frombuf(STR) -> (X, REST): read buffer format")
#undef METHNAME
{ 0 }
};
return (z);
}
-static PyObject *meth__GF_fromstring(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *gfmeth_fromstring(PyObject *me,
+ PyObject *arg, PyObject *kw)
{
int r = 0;
char *p;
PyObject *z = 0;
mp *zz;
mptext_stringctx sc;
- static const char *const kwlist[] = { "class", "x", "radix", 0 };
+ static const char *const kwlist[] = { "x", "radix", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|i:fromstring",
- KWLIST, &me, &p, &len, &r))
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#|i:fromstring", KWLIST,
+ &p, &len, &r))
goto end;
if (!good_radix_p(r, 1)) VALERR("bad radix");
sc.buf = p; sc.lim = p + len;
METH (gcdx, "X.gcdx(Y) -> (gcd(X, Y), U, V) with X U + Y V = gcd(X, Y)")
METH (modinv, "X.modinv(Y) -> multiplicative inverse of Y mod X")
METH (irreduciblep, "X.irreduciblep() -> true/false")
+ KWSMTH(fromstring, "fromstring(STR, [radix = 0]) -> (X, REST)\n"
+ " Parse STR as a binary polynomial, according to RADIX. If RADIX is\n"
+ " zero, read a prefix from STR to decide radix: allow `0b' for binary,\n"
+ " `0' or `0o' for octal, `0x' for hex, or `R_' for other radix R.")
+ SMTH (loadl, "loadl(STR) -> X: read little-endian bytes")
+ SMTH (loadb, "loadb(STR) -> X: read big-endian bytes")
+ SMTH (frombuf, "frombuf(STR) -> (X, REST): read buffer format")
#undef METHNAME
#define METHNAME(func) mpmeth_##func
KWMETH(tostring, "X.tostring([radix = 10]) -> STR")
/*----- Glue --------------------------------------------------------------*/
-static const PyMethodDef methods[] = {
-#define METHNAME(func) meth_##func
- KWMETH(_MP_fromstring, "fromstring(STR, [radix = 0]) -> (X, REST)\n"
- " Parse STR as a large integer, according to RADIX. If RADIX is\n"
- " zero, read a prefix from STR to decide radix: allow `0b' for binary,\n"
- " `0' or `0o' for octal, `0x' for hex, or `R_' for other radix R.")
- KWMETH(_GF_fromstring, "fromstring(STR, [radix = 0]) -> (X, REST)\n"
- " Parse STR as a binary polynomial, according to RADIX. If RADIX is\n"
- " zero, read a prefix from STR to decide radix: allow `0b' for binary,\n"
- " `0' or `0o' for octal, `0x' for hex, or `R_' for other radix R.")
- METH (_MP_factorial, "factorial(I) -> I!: compute factorial")
- METH (_MP_fibonacci, "fibonacci(I) -> F(I): compute Fibonacci number")
- METH (_MP_loadl, "loadl(STR) -> X: read little-endian bytes")
- METH (_MP_loadb, "loadb(STR) -> X: read big-endian bytes")
- METH (_MP_loadl2c, "loadl2c(STR) -> X: "
- "read little-endian bytes, two's complement")
- METH (_MP_loadb2c, "loadb2c(STR) -> X: "
- "read big-endian bytes, two's complement")
- METH (_MP_frombuf, "frombuf(STR) -> (X, REST): read buffer format")
- METH (_GF_loadl, "loadl(STR) -> X: read little-endian bytes")
- METH (_GF_loadb, "loadb(STR) -> X: read big-endian bytes")
- METH (_GF_frombuf, "frombuf(STR) -> (X, REST): read buffer format")
-#undef METHNAME
- { 0 }
-};
-
void mp_pyinit(void)
{
INITTYPE(mp, root);
INITTYPE(mpcrt, root);
INITTYPE(gfreduce, root);
INITTYPE(gfn, root);
- addmethods(methods);
}
void mp_pyinsert(PyObject *mod)
RETURN_ME;
}
-static PyObject *meth__PrimeFilter_smallfactor(PyObject *me, PyObject *arg)
+static PyObject *pfmeth_smallfactor(PyObject *me, PyObject *arg)
{
mp *x = 0;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, "OO&:smallfactor", &me, convmp, &x)) goto end;
+ if (!PyArg_ParseTuple(arg, "O&:smallfactor", convmp, &x)) goto end;
rc = PyInt_FromLong(pfilt_smallfactor(x));
end:
mp_drop(x);
METH (step, "F.step(N)")
METH (muladd, "F.muladd(M, A)")
METH (jump, "F.jump(FF)")
+ SMTH (smallfactor, "smallfactor(X) -> PGST")
#undef METHNAME
{ 0 }
};
static PyObject *rget_x(PyObject *me, void *hunoz)
{ return (mp_pywrap(MP_COPY(RABIN_R(me)->mm.m))); }
-static PyObject *meth__RabinMiller_iters(PyObject *me, PyObject *arg)
+static PyObject *rmeth_iters(PyObject *me, PyObject *arg)
{
unsigned n;
- if (!PyArg_ParseTuple(arg, "OO&:iters", &me, convuint, &n)) return (0);
+ if (!PyArg_ParseTuple(arg, "O&:iters", convuint, &n)) return (0);
return (PyInt_FromLong(rabin_iters(n)));
}
#define METHNAME(name) rmeth_##name
METH (test, "R.test(W) -> PGST")
METH (rtest, "R.rtest(W) -> PGST")
+ SMTH (iters, "iters(NBITS) -> NITERS")
#undef METHNAME
{ 0 }
};
static const PyMethodDef methods[] = {
#define METHNAME(name) meth_##name
- METH (_PrimeFilter_smallfactor, "smallfactor(X) -> PGRC")
- METH (_RabinMiller_iters, "iters(NBITS) -> NITERS")
KWMETH(pgen,
"pgen(START, [name = 'p'], [stepper = PrimeGenStepper(2)],\n"
" [tester = PrimeGenTester()], [event = pgen_nullev],\n"
return (rc);
}
-static PyObject *meth__RSAPriv_generate(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *rsameth_generate(PyObject *me, PyObject *arg, PyObject *kw)
{
grand *r = &rand_global;
unsigned nbits;
struct excinfo exc = EXCINFO_INIT;
pypgev evt = { { 0 } };
static const char *const kwlist[] =
- { "class", "nbits", "event", "rng", "nsteps", "e", 0 };
+ { "nbits", "event", "rng", "nsteps", "e", 0 };
PyObject *rc = 0;
evt.exc = &exc;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", KWLIST,
- &me, convuint, &nbits, convpgev, &evt,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|O&O&O&O&:generate", KWLIST,
+ convuint, &nbits, convpgev, &evt,
convgrand, &r, convuint, &n,
convmp, &e))
goto end;
static const PyMethodDef rsapriv_pymethods[] = {
#define METHNAME(name) rsameth_##name
- KWMETH(privop, "R.privop(X, [rng = None]) -> X^D (mod N)")
+ KWMETH(privop, "R.privop(X, [rng = None]) -> X^D (mod N)")
+ KWSMTH(generate, "generate(NBITS, [event = pgen_nullev], [rng = rand], "
+ "[nsteps = 0]) -> R")
#undef METHNAME
{ 0 }
};
KWMETH(_oaep_decode, 0)
KWMETH(_pss_encode, 0)
KWMETH(_pss_decode, 0)
- KWMETH(_RSAPriv_generate, "generate(NBITS, [event = pgen_nullev], "
- "[rng = rand], [nsteps = 0]) -> R")
#define DEFMETH(X, x) \
METH (x, "" #x "(KEY, PUBLIC) -> SHARED")
XDHS(DEFMETH)
/* Macros for filling in `PyMethodDef' tables, ensuring that functions have
* the expected signatures.
*/
-#define STD_METHOD(decor, func, doc) \
- { #func, decor(func), METH_VARARGS, doc },
-#define KEYWORD_METHOD(decor, func, doc) \
+#define STD_METHOD(decor, func, flags, doc) \
+ { #func, decor(func), METH_VARARGS | flags, doc },
+#define KEYWORD_METHOD(decor, func, flags, doc) \
{ #func, \
CONVERT_CAREFULLY(PyCFunction, PyCFunctionWithKeywords, decor(func)), \
- METH_VARARGS | METH_KEYWORDS, \
+ METH_VARARGS | METH_KEYWORDS | flags, \
doc },
/* Convenience wrappers for filling in `PyMethodDef' tables, following
*
* around the method table.
*/
-#define METH(func, doc) STD_METHOD(METHNAME, func, doc)
-#define KWMETH(func, doc) KEYWORD_METHOD(METHNAME, func, doc)
+#define METH(func, doc) STD_METHOD(METHNAME, func, 0, doc)
+#define KWMETH(func, doc) KEYWORD_METHOD(METHNAME, func, 0, doc)
+#define CMTH(func, doc) STD_METHOD(METHNAME, func, METH_CLASS, doc)
+#define KWCMTH(func, doc) KEYWORD_METHOD(METHNAME, func, METH_CLASS, doc)
+#define SMTH(func, doc) STD_METHOD(METHNAME, func, METH_STATIC, doc)
+#define KWSMTH(func, doc) KEYWORD_METHOD(METHNAME, func, METH_STATIC, doc)
/* Convenience wrappers for filling in `PyGetSetDef' tables, following Pyke
* naming convention. Define `GETSETNAME' locally as
/* Mapping methods. */
#define GMAP_METMNAME(func) gmapmeth_##func
-#define GMAP_METH(func, doc) STD_METHOD(GMAP_METMNAME, func, doc)
-#define GMAP_KWMETH(func, doc) KEYWORD_METHOD(GMAP_METMNAME, func, doc)
+#define GMAP_METH(func, doc) STD_METHOD(GMAP_METMNAME, func, 0, doc)
+#define GMAP_KWMETH(func, doc) KEYWORD_METHOD(GMAP_METMNAME, func, 0, doc)
#define GMAP_METHDECL(func, doc) \
extern PyObject *gmapmeth_##func(PyObject *, PyObject *);
#define GMAP_KWMETHDECL(func, doc) \
return ((PyObject *)rc);
}
-static PyObject *meth__BBSPriv_generate(PyObject *me,
- PyObject *arg, PyObject *kw)
+static PyObject *bpmeth_generate(PyObject *me, PyObject *arg, PyObject *kw)
{
bbs_priv bp = { 0 };
mp *x = MP_TWO;
unsigned nbits, n = 0;
grand *r = &rand_global;
static const char *const kwlist[] =
- { "class", "nbits", "event", "rng", "nsteps", "seed", 0 };
+ { "nbits", "event", "rng", "nsteps", "seed", 0 };
bbspriv_pyobj *rc = 0;
evt.exc = &exc;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", KWLIST,
- &me, convuint, &nbits, convpgev, &evt,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|O&O&O&O&:generate", KWLIST,
+ convuint, &nbits, convpgev, &evt,
convgrand, &r, convuint, &n, convmp, &x))
goto end;
if (bbs_gen(&bp, nbits, r, n, evt.ev.proc, evt.ev.ctx))
#define METHNAME(name) bpmeth_##name
METH (ff, "R.ff(N): fast-forward N places")
METH (rew, "R.rew(N): rewind N places")
+ KWSMTH(generate, "generate(NBITS, [event = pgen_nullev], "
+ "[rng = rand], [nsteps = 0], [seed = 2]) -> R")
#undef METHNAME
{ 0 }
};
/*----- Global stuff ------------------------------------------------------*/
-static const PyMethodDef methods[] = {
-#define METHNAME(name) meth_##name
- KWMETH(_BBSPriv_generate, "generate(NBITS, [event = pgen_nullev], "
- "[rng = rand], [nsteps = 0], [seed = 2]) -> R")
-#undef METHNAME
- { 0 }
-};
-
void rand_pyinit(void)
{
INITTYPE(grand, root);
INITTYPE(gclatinrand, gcrand);
rand_noisesrc(RAND_GLOBAL, &noise_source);
rand_seed(RAND_GLOBAL, 160);
- addmethods(methods);
}
#define gccrand gccrand_info