Skip to content
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

key_length must have a default value. #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions blake2/blake2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static PyObject * blake2b_func(PyObject *self, PyObject *args, PyObject *keywds

char *data;
int data_length;
int key_length ;
int key_length = 0;
long hashSize = BLAKE2B_OUTBYTES;
char *key = "";
int rawOutput = 1 ;
Expand Down Expand Up @@ -58,7 +58,7 @@ static PyObject * blake2s_func(PyObject *self, PyObject *args, PyObject *keywds

char *data;
int data_length;
int key_length ;
int key_length = 0;
long hashSize = BLAKE2S_OUTBYTES;
char *key = "";
int rawOutput = 1 ;
Expand Down
2 changes: 2 additions & 0 deletions blake2test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def blake2b():
assert blake2.blake2("hello world", hashSize=16, key="hello world") == '8fe7d57f5c53d8afd00f552269502b81'
assert blake2.blake2("hello world", hashSize=4, key="hello world") == 'bbd7cc6e'
assert blake2.blake2("hello\x00world", key="hello\x00world") == 'e06e51bbdc12363243a55ddc23aaeb310faceec72e21d93c85d7e77360aa48cb6baf2963661bf857b1686c89f5dd209f0abee10aa2e38d0318043718976bcb60'
assert blake2.blake2('\x00') == blake2.blake2('\x00')
assert blake2.blake2(None) == None


Expand All @@ -25,6 +26,7 @@ def blake2s():
assert blake2.blake2s("hello world", hashSize=16, key="hello world") == '4e989fc7739d052dd93ec88962137c08'
assert blake2.blake2s("hello world", hashSize=4, key="hello world") == 'fef7f902'
assert blake2.blake2s("hello\x00world", key="hello\x00world") == '36429945e82aec7853fd2bd1c7349a65e4457db81c059b287f7a859e3b26e3f4'
assert blake2.blake2s('\x00') == blake2.blake2s('\x00')
assert blake2.blake2s(None) == None


Expand Down