Home | History | Annotate | Download | only in clinic
      1 /*[clinic input]
      2 preserve
      3 [clinic start generated code]*/
      4 
      5 PyDoc_STRVAR(py_sha3_new__doc__,
      6 "sha3_224(string=None)\n"
      7 "--\n"
      8 "\n"
      9 "Return a new SHA3 hash object with a hashbit length of 28 bytes.");
     10 
     11 static PyObject *
     12 py_sha3_new_impl(PyTypeObject *type, PyObject *data);
     13 
     14 static PyObject *
     15 py_sha3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     16 {
     17     PyObject *return_value = NULL;
     18     static const char * const _keywords[] = {"string", NULL};
     19     static _PyArg_Parser _parser = {"|O:sha3_224", _keywords, 0};
     20     PyObject *data = NULL;
     21 
     22     if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser,
     23         &data)) {
     24         goto exit;
     25     }
     26     return_value = py_sha3_new_impl(type, data);
     27 
     28 exit:
     29     return return_value;
     30 }
     31 
     32 PyDoc_STRVAR(_sha3_sha3_224_copy__doc__,
     33 "copy($self, /)\n"
     34 "--\n"
     35 "\n"
     36 "Return a copy of the hash object.");
     37 
     38 #define _SHA3_SHA3_224_COPY_METHODDEF    \
     39     {"copy", (PyCFunction)_sha3_sha3_224_copy, METH_NOARGS, _sha3_sha3_224_copy__doc__},
     40 
     41 static PyObject *
     42 _sha3_sha3_224_copy_impl(SHA3object *self);
     43 
     44 static PyObject *
     45 _sha3_sha3_224_copy(SHA3object *self, PyObject *Py_UNUSED(ignored))
     46 {
     47     return _sha3_sha3_224_copy_impl(self);
     48 }
     49 
     50 PyDoc_STRVAR(_sha3_sha3_224_digest__doc__,
     51 "digest($self, /)\n"
     52 "--\n"
     53 "\n"
     54 "Return the digest value as a string of binary data.");
     55 
     56 #define _SHA3_SHA3_224_DIGEST_METHODDEF    \
     57     {"digest", (PyCFunction)_sha3_sha3_224_digest, METH_NOARGS, _sha3_sha3_224_digest__doc__},
     58 
     59 static PyObject *
     60 _sha3_sha3_224_digest_impl(SHA3object *self);
     61 
     62 static PyObject *
     63 _sha3_sha3_224_digest(SHA3object *self, PyObject *Py_UNUSED(ignored))
     64 {
     65     return _sha3_sha3_224_digest_impl(self);
     66 }
     67 
     68 PyDoc_STRVAR(_sha3_sha3_224_hexdigest__doc__,
     69 "hexdigest($self, /)\n"
     70 "--\n"
     71 "\n"
     72 "Return the digest value as a string of hexadecimal digits.");
     73 
     74 #define _SHA3_SHA3_224_HEXDIGEST_METHODDEF    \
     75     {"hexdigest", (PyCFunction)_sha3_sha3_224_hexdigest, METH_NOARGS, _sha3_sha3_224_hexdigest__doc__},
     76 
     77 static PyObject *
     78 _sha3_sha3_224_hexdigest_impl(SHA3object *self);
     79 
     80 static PyObject *
     81 _sha3_sha3_224_hexdigest(SHA3object *self, PyObject *Py_UNUSED(ignored))
     82 {
     83     return _sha3_sha3_224_hexdigest_impl(self);
     84 }
     85 
     86 PyDoc_STRVAR(_sha3_sha3_224_update__doc__,
     87 "update($self, obj, /)\n"
     88 "--\n"
     89 "\n"
     90 "Update this hash object\'s state with the provided string.");
     91 
     92 #define _SHA3_SHA3_224_UPDATE_METHODDEF    \
     93     {"update", (PyCFunction)_sha3_sha3_224_update, METH_O, _sha3_sha3_224_update__doc__},
     94 
     95 PyDoc_STRVAR(_sha3_shake_128_digest__doc__,
     96 "digest($self, /, length)\n"
     97 "--\n"
     98 "\n"
     99 "Return the digest value as a string of binary data.");
    100 
    101 #define _SHA3_SHAKE_128_DIGEST_METHODDEF    \
    102     {"digest", (PyCFunction)_sha3_shake_128_digest, METH_FASTCALL, _sha3_shake_128_digest__doc__},
    103 
    104 static PyObject *
    105 _sha3_shake_128_digest_impl(SHA3object *self, unsigned long length);
    106 
    107 static PyObject *
    108 _sha3_shake_128_digest(SHA3object *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
    109 {
    110     PyObject *return_value = NULL;
    111     static const char * const _keywords[] = {"length", NULL};
    112     static _PyArg_Parser _parser = {"k:digest", _keywords, 0};
    113     unsigned long length;
    114 
    115     if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
    116         &length)) {
    117         goto exit;
    118     }
    119     return_value = _sha3_shake_128_digest_impl(self, length);
    120 
    121 exit:
    122     return return_value;
    123 }
    124 
    125 PyDoc_STRVAR(_sha3_shake_128_hexdigest__doc__,
    126 "hexdigest($self, /, length)\n"
    127 "--\n"
    128 "\n"
    129 "Return the digest value as a string of hexadecimal digits.");
    130 
    131 #define _SHA3_SHAKE_128_HEXDIGEST_METHODDEF    \
    132     {"hexdigest", (PyCFunction)_sha3_shake_128_hexdigest, METH_FASTCALL, _sha3_shake_128_hexdigest__doc__},
    133 
    134 static PyObject *
    135 _sha3_shake_128_hexdigest_impl(SHA3object *self, unsigned long length);
    136 
    137 static PyObject *
    138 _sha3_shake_128_hexdigest(SHA3object *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
    139 {
    140     PyObject *return_value = NULL;
    141     static const char * const _keywords[] = {"length", NULL};
    142     static _PyArg_Parser _parser = {"k:hexdigest", _keywords, 0};
    143     unsigned long length;
    144 
    145     if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser,
    146         &length)) {
    147         goto exit;
    148     }
    149     return_value = _sha3_shake_128_hexdigest_impl(self, length);
    150 
    151 exit:
    152     return return_value;
    153 }
    154 /*[clinic end generated code: output=9888beab45136a56 input=a9049054013a1b77]*/
    155