8000 gh-135004: rewrite and cleanup `blake2module.c` by picnixz · Pull Request #135006 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-135004: rewrite and cleanup blake2module.c #135006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 9, 2025
Merged
Prev Previous commit
Next Next commit
simplify py_blake2b_get_name and py_blake2b_get_block_size
  • Loading branch information
picnixz committed Jun 5, 2025
commit 1172bdf95921f4f825df56c8b8b03e8ff9c723a3
6 changes: 2 additions & 4 deletions Modules/blake2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,20 +907,18 @@ static PyObject *
py_blake2b_get_name(PyObject *op, void *Py_UNUSED(closure))
{
Blake2Object *self = _Blake2Object_CAST(op);
return PyUnicode_FromString(is_blake2b(self->impl) ? "blake2b" : "blake2s");
return PyUnicode_FromString(BLAKE2_IMPLNAME(self));
}



static PyObject *
py_blake2b_get_block_size(PyObject *op, void *Py_UNUSED(closure))
{
Blake2Object *self = _Blake2Object_CAST(op);
return PyLong_FromLong(is_blake2b(self->impl) ? HACL_HASH_BLAKE2B_BLOCK_BYTES : HACL_HASH_BLAKE2S_BLOCK_BYTES);
return PyLong_FromLong(GET_BLAKE2_CONST(self, BLOCK_BYTES));
}



static PyObject *
py_blake2b_get_digest_size(PyObject *op, void *Py_UNUSED(closure))
{
Expand Down
0