Skip to content

Commit ff9e872

Browse files
committed
simplify py_blake2b_get_name and py_blake2b_get_block_size
1 parent 35c93ea commit ff9e872

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Modules/blake2module.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,20 +906,18 @@ static PyObject *
906906
py_blake2b_get_name(PyObject *op, void *Py_UNUSED(closure))
907907
{
908908
Blake2Object *self = _Blake2Object_CAST(op);
909-
return PyUnicode_FromString(is_blake2b(self->impl) ? "blake2b" : "blake2s");
909+
return PyUnicode_FromString(BLAKE2_IMPLNAME(self));
910910
}
911911

912912

913-
914913
static PyObject *
915914
py_blake2b_get_block_size(PyObject *op, void *Py_UNUSED(closure))
916915
{
917916
Blake2Object *self = _Blake2Object_CAST(op);
918-
return PyLong_FromLong(is_blake2b(self->impl) ? HACL_HASH_BLAKE2B_BLOCK_BYTES : HACL_HASH_BLAKE2S_BLOCK_BYTES);
917+
return PyLong_FromLong(GET_BLAKE2_CONST(self, BLOCK_BYTES));
919918
}
920919

921920

922-
923921
static PyObject *
924922
py_blake2b_get_digest_size(PyObject *op, void *Py_UNUSED(closure))
925923
{

0 commit comments

Comments
 (0)