Skip to content

Commit e4e1cad

Browse files
committed
Add size parameter for Sapling
1 parent 4e3def1 commit e4e1cad

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

yescrypt.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ static int yescrypt_bitzeny(const uint8_t *passwd, size_t passwdlen,
102102

103103
#endif
104104

105-
static void yescrypt_hash(const char *input, char *output)
105+
static void yescrypt_hash(const char *input, char *output, int size)
106106
{
107-
yescrypt_bitzeny((const uint8_t *) input, 80,
108-
(const uint8_t *) input, 80,
107+
yescrypt_bitzeny((const uint8_t *) input, size,
108+
(const uint8_t *) input, size,
109109
(uint8_t *) output, 32);
110110
}
111111

@@ -118,15 +118,16 @@ static PyObject *yescrypt_getpowhash(PyObject *self, PyObject *args)
118118
#else
119119
PyStringObject *input;
120120
#endif
121-
if (!PyArg_ParseTuple(args, "S", &input))
121+
int size = 80;
122+
if (!PyArg_ParseTuple(args, "S|i", &input, &size))
122123
return NULL;
123124
Py_INCREF(input);
124125
output = PyMem_Malloc(32);
125126

126127
#if PY_MAJOR_VERSION >= 3
127-
yescrypt_hash((char *)PyBytes_AsString((PyObject*) input), output);
128+
yescrypt_hash((char *)PyBytes_AsString((PyObject*) input), output, size);
128129
#else
129-
yescrypt_hash((char *)PyString_AsString((PyObject*) input), output);
130+
yescrypt_hash((char *)PyString_AsString((PyObject*) input), output, size);
130131
#endif
131132
Py_DECREF(input);
132133
#if PY_MAJOR_VERSION >= 3

0 commit comments

Comments
 (0)