summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Modules/_sha3
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Modules/_sha3
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Modules/_sha3')
-rw-r--r--contrib/tools/python3/src/Modules/_sha3/clinic/sha3module.c.h166
-rw-r--r--contrib/tools/python3/src/Modules/_sha3/sha3module.c80
2 files changed, 123 insertions, 123 deletions
diff --git a/contrib/tools/python3/src/Modules/_sha3/clinic/sha3module.c.h b/contrib/tools/python3/src/Modules/_sha3/clinic/sha3module.c.h
index 4c1987488e7..1c79c269391 100644
--- a/contrib/tools/python3/src/Modules/_sha3/clinic/sha3module.c.h
+++ b/contrib/tools/python3/src/Modules/_sha3/clinic/sha3module.c.h
@@ -2,52 +2,52 @@
preserve
[clinic start generated code]*/
-PyDoc_STRVAR(py_sha3_new__doc__,
-"sha3_224(data=b\'\', /, *, usedforsecurity=True)\n"
-"--\n"
-"\n"
-"Return a new BLAKE2b hash object.");
-
-static PyObject *
-py_sha3_new_impl(PyTypeObject *type, PyObject *data, int usedforsecurity);
-
-static PyObject *
-py_sha3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
-{
- PyObject *return_value = NULL;
- static const char * const _keywords[] = {"", "usedforsecurity", NULL};
- static _PyArg_Parser _parser = {NULL, _keywords, "sha3_224", 0};
- PyObject *argsbuf[2];
- PyObject * const *fastargs;
- Py_ssize_t nargs = PyTuple_GET_SIZE(args);
- Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
- PyObject *data = NULL;
- int usedforsecurity = 1;
-
- fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
- if (!fastargs) {
- goto exit;
- }
- if (nargs < 1) {
- goto skip_optional_posonly;
- }
- noptargs--;
- data = fastargs[0];
-skip_optional_posonly:
- if (!noptargs) {
- goto skip_optional_kwonly;
- }
- usedforsecurity = PyObject_IsTrue(fastargs[1]);
- if (usedforsecurity < 0) {
- goto exit;
- }
-skip_optional_kwonly:
- return_value = py_sha3_new_impl(type, data, usedforsecurity);
-
-exit:
- return return_value;
-}
-
+PyDoc_STRVAR(py_sha3_new__doc__,
+"sha3_224(data=b\'\', /, *, usedforsecurity=True)\n"
+"--\n"
+"\n"
+"Return a new BLAKE2b hash object.");
+
+static PyObject *
+py_sha3_new_impl(PyTypeObject *type, PyObject *data, int usedforsecurity);
+
+static PyObject *
+py_sha3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"", "usedforsecurity", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "sha3_224", 0};
+ PyObject *argsbuf[2];
+ PyObject * const *fastargs;
+ Py_ssize_t nargs = PyTuple_GET_SIZE(args);
+ Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
+ PyObject *data = NULL;
+ int usedforsecurity = 1;
+
+ fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
+ if (!fastargs) {
+ goto exit;
+ }
+ if (nargs < 1) {
+ goto skip_optional_posonly;
+ }
+ noptargs--;
+ data = fastargs[0];
+skip_optional_posonly:
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ usedforsecurity = PyObject_IsTrue(fastargs[1]);
+ if (usedforsecurity < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
+ return_value = py_sha3_new_impl(type, data, usedforsecurity);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(_sha3_sha3_224_copy__doc__,
"copy($self, /)\n"
"--\n"
@@ -120,24 +120,24 @@ PyDoc_STRVAR(_sha3_shake_128_digest__doc__,
#define _SHA3_SHAKE_128_DIGEST_METHODDEF \
{"digest", (PyCFunction)_sha3_shake_128_digest, METH_O, _sha3_shake_128_digest__doc__},
-static PyObject *
-_sha3_shake_128_digest_impl(SHA3object *self, unsigned long length);
-
-static PyObject *
-_sha3_shake_128_digest(SHA3object *self, PyObject *arg)
-{
- PyObject *return_value = NULL;
- unsigned long length;
-
- if (!_PyLong_UnsignedLong_Converter(arg, &length)) {
- goto exit;
- }
- return_value = _sha3_shake_128_digest_impl(self, length);
-
-exit:
- return return_value;
-}
-
+static PyObject *
+_sha3_shake_128_digest_impl(SHA3object *self, unsigned long length);
+
+static PyObject *
+_sha3_shake_128_digest(SHA3object *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ unsigned long length;
+
+ if (!_PyLong_UnsignedLong_Converter(arg, &length)) {
+ goto exit;
+ }
+ return_value = _sha3_shake_128_digest_impl(self, length);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(_sha3_shake_128_hexdigest__doc__,
"hexdigest($self, length, /)\n"
"--\n"
@@ -146,22 +146,22 @@ PyDoc_STRVAR(_sha3_shake_128_hexdigest__doc__,
#define _SHA3_SHAKE_128_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)_sha3_shake_128_hexdigest, METH_O, _sha3_shake_128_hexdigest__doc__},
-
-static PyObject *
-_sha3_shake_128_hexdigest_impl(SHA3object *self, unsigned long length);
-
-static PyObject *
-_sha3_shake_128_hexdigest(SHA3object *self, PyObject *arg)
-{
- PyObject *return_value = NULL;
- unsigned long length;
-
- if (!_PyLong_UnsignedLong_Converter(arg, &length)) {
- goto exit;
- }
- return_value = _sha3_shake_128_hexdigest_impl(self, length);
-
-exit:
- return return_value;
-}
-/*[clinic end generated code: output=c8a97b34e80def62 input=a9049054013a1b77]*/
+
+static PyObject *
+_sha3_shake_128_hexdigest_impl(SHA3object *self, unsigned long length);
+
+static PyObject *
+_sha3_shake_128_hexdigest(SHA3object *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ unsigned long length;
+
+ if (!_PyLong_UnsignedLong_Converter(arg, &length)) {
+ goto exit;
+ }
+ return_value = _sha3_shake_128_hexdigest_impl(self, length);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=c8a97b34e80def62 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/Modules/_sha3/sha3module.c b/contrib/tools/python3/src/Modules/_sha3/sha3module.c
index 5c7b9f38dc0..b6a7130dd86 100644
--- a/contrib/tools/python3/src/Modules/_sha3/sha3module.c
+++ b/contrib/tools/python3/src/Modules/_sha3/sha3module.c
@@ -40,7 +40,7 @@
#elif PY_BIG_ENDIAN
/* opt64 is not yet supported on big endian platforms */
#define KeccakOpt 32
-#elif SIZEOF_VOID_P == 8
+#elif SIZEOF_VOID_P == 8
/* opt64 works only on little-endian 64bit platforms with unsigned int64 */
#define KeccakOpt 64
#else
@@ -48,9 +48,9 @@
#define KeccakOpt 32
#endif
-#if KeccakOpt == 64
+#if KeccakOpt == 64
/* 64bit platforms with unsigned int64 */
- typedef uint64_t UINT64;
+ typedef uint64_t UINT64;
typedef unsigned char UINT8;
#endif
@@ -64,11 +64,11 @@
#define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
#endif
-/* Prevent bus errors on platforms requiring aligned accesses such ARM. */
-#if HAVE_ALIGNED_REQUIRED && !defined(NO_MISALIGNED_ACCESSES)
-#define NO_MISALIGNED_ACCESSES
-#endif
-
+/* Prevent bus errors on platforms requiring aligned accesses such ARM. */
+#if HAVE_ALIGNED_REQUIRED && !defined(NO_MISALIGNED_ACCESSES)
+#define NO_MISALIGNED_ACCESSES
+#endif
+
/* mangle names */
#define KeccakF1600_FastLoop_Absorb _PySHA3_KeccakF1600_FastLoop_Absorb
#define Keccak_HashFinal _PySHA3_Keccak_HashFinal
@@ -174,20 +174,20 @@ newSHA3object(PyTypeObject *type)
return newobj;
}
-/*[clinic input]
-@classmethod
-_sha3.sha3_224.__new__ as py_sha3_new
- data: object(c_default="NULL") = b''
- /
- *
- usedforsecurity: bool = True
+/*[clinic input]
+@classmethod
+_sha3.sha3_224.__new__ as py_sha3_new
+ data: object(c_default="NULL") = b''
+ /
+ *
+ usedforsecurity: bool = True
+
+Return a new BLAKE2b hash object.
+[clinic start generated code]*/
-Return a new BLAKE2b hash object.
-[clinic start generated code]*/
-
static PyObject *
-py_sha3_new_impl(PyTypeObject *type, PyObject *data, int usedforsecurity)
-/*[clinic end generated code: output=90409addc5d5e8b0 input=bcfcdf2e4368347a]*/
+py_sha3_new_impl(PyTypeObject *type, PyObject *data, int usedforsecurity)
+/*[clinic end generated code: output=90409addc5d5e8b0 input=bcfcdf2e4368347a]*/
{
SHA3object *self = NULL;
Py_buffer buf = {NULL, NULL};
@@ -501,10 +501,10 @@ static PyGetSetDef SHA3_getseters[] = {
0, /* tp_itemsize */ \
/* methods */ \
(destructor)SHA3_dealloc, /* tp_dealloc */ \
- 0, /* tp_vectorcall_offset */ \
+ 0, /* tp_vectorcall_offset */ \
0, /* tp_getattr */ \
0, /* tp_setattr */ \
- 0, /* tp_as_async */ \
+ 0, /* tp_as_async */ \
0, /* tp_repr */ \
0, /* tp_as_number */ \
0, /* tp_as_sequence */ \
@@ -537,22 +537,22 @@ static PyGetSetDef SHA3_getseters[] = {
}
PyDoc_STRVAR(sha3_224__doc__,
-"sha3_224([data], *, usedforsecurity=True) -> SHA3 object\n\
+"sha3_224([data], *, usedforsecurity=True) -> SHA3 object\n\
\n\
Return a new SHA3 hash object with a hashbit length of 28 bytes.");
PyDoc_STRVAR(sha3_256__doc__,
-"sha3_256([data], *, usedforsecurity=True) -> SHA3 object\n\
+"sha3_256([data], *, usedforsecurity=True) -> SHA3 object\n\
\n\
Return a new SHA3 hash object with a hashbit length of 32 bytes.");
PyDoc_STRVAR(sha3_384__doc__,
-"sha3_384([data], *, usedforsecurity=True) -> SHA3 object\n\
+"sha3_384([data], *, usedforsecurity=True) -> SHA3 object\n\
\n\
Return a new SHA3 hash object with a hashbit length of 48 bytes.");
PyDoc_STRVAR(sha3_512__doc__,
-"sha3_512([data], *, usedforsecurity=True) -> SHA3 object\n\
+"sha3_512([data], *, usedforsecurity=True) -> SHA3 object\n\
\n\
Return a new SHA3 hash object with a hashbit length of 64 bytes.");
@@ -563,22 +563,22 @@ SHA3_TYPE(SHA3_512type, "_sha3.sha3_512", sha3_512__doc__, SHA3_methods);
#ifdef PY_WITH_KECCAK
PyDoc_STRVAR(keccak_224__doc__,
-"keccak_224([data], *, usedforsecurity=True) -> Keccak object\n\
+"keccak_224([data], *, usedforsecurity=True) -> Keccak object\n\
\n\
Return a new Keccak hash object with a hashbit length of 28 bytes.");
PyDoc_STRVAR(keccak_256__doc__,
-"keccak_256([data], *, usedforsecurity=True) -> Keccak object\n\
+"keccak_256([data], *, usedforsecurity=True) -> Keccak object\n\
\n\
Return a new Keccak hash object with a hashbit length of 32 bytes.");
PyDoc_STRVAR(keccak_384__doc__,
-"keccak_384([data], *, usedforsecurity=True) -> Keccak object\n\
+"keccak_384([data], *, usedforsecurity=True) -> Keccak object\n\
\n\
Return a new Keccak hash object with a hashbit length of 48 bytes.");
PyDoc_STRVAR(keccak_512__doc__,
-"keccak_512([data], *, usedforsecurity=True) -> Keccak object\n\
+"keccak_512([data], *, usedforsecurity=True) -> Keccak object\n\
\n\
Return a new Keccak hash object with a hashbit length of 64 bytes.");
@@ -590,7 +590,7 @@ SHA3_TYPE(Keccak_512type, "_sha3.keccak_512", keccak_512__doc__, SHA3_methods);
static PyObject *
-_SHAKE_digest(SHA3object *self, unsigned long digestlen, int hex)
+_SHAKE_digest(SHA3object *self, unsigned long digestlen, int hex)
{
unsigned char *digest = NULL;
SHA3_state temp;
@@ -640,15 +640,15 @@ _SHAKE_digest(SHA3object *self, unsigned long digestlen, int hex)
/*[clinic input]
_sha3.shake_128.digest
- length: unsigned_long
+ length: unsigned_long
/
Return the digest value as a bytes object.
[clinic start generated code]*/
static PyObject *
-_sha3_shake_128_digest_impl(SHA3object *self, unsigned long length)
-/*[clinic end generated code: output=2313605e2f87bb8f input=418ef6a36d2e6082]*/
+_sha3_shake_128_digest_impl(SHA3object *self, unsigned long length)
+/*[clinic end generated code: output=2313605e2f87bb8f input=418ef6a36d2e6082]*/
{
return _SHAKE_digest(self, length, 0);
}
@@ -657,15 +657,15 @@ _sha3_shake_128_digest_impl(SHA3object *self, unsigned long length)
/*[clinic input]
_sha3.shake_128.hexdigest
- length: unsigned_long
+ length: unsigned_long
/
Return the digest value as a string of hexadecimal digits.
[clinic start generated code]*/
static PyObject *
-_sha3_shake_128_hexdigest_impl(SHA3object *self, unsigned long length)
-/*[clinic end generated code: output=bf8e2f1e490944a8 input=69fb29b0926ae321]*/
+_sha3_shake_128_hexdigest_impl(SHA3object *self, unsigned long length)
+/*[clinic end generated code: output=bf8e2f1e490944a8 input=69fb29b0926ae321]*/
{
return _SHAKE_digest(self, length, 1);
}
@@ -680,12 +680,12 @@ static PyMethodDef SHAKE_methods[] = {
};
PyDoc_STRVAR(shake_128__doc__,
-"shake_128([data], *, usedforsecurity=True) -> SHAKE object\n\
+"shake_128([data], *, usedforsecurity=True) -> SHAKE object\n\
\n\
Return a new SHAKE hash object.");
PyDoc_STRVAR(shake_256__doc__,
-"shake_256([data], *, usedforsecurity=True) -> SHAKE object\n\
+"shake_256([data], *, usedforsecurity=True) -> SHAKE object\n\
\n\
Return a new SHAKE hash object.");
@@ -718,7 +718,7 @@ PyInit__sha3(void)
#define init_sha3type(name, type) \
do { \
- Py_SET_TYPE(type, &PyType_Type); \
+ Py_SET_TYPE(type, &PyType_Type); \
if (PyType_Ready(type) < 0) { \
goto error; \
} \