More tests.

This commit is contained in:
NIIBE Yutaka
2018-04-04 16:34:07 +09:00
parent 44971541fe
commit f7b03f7fb5
6 changed files with 117 additions and 15 deletions

View File

@@ -37,7 +37,11 @@ def kdf_calc(pw_string, salt_byte, iterations):
ffi = FFI()
ffi.cdef(DEF_gcry_kdf_derive)
libgcrypt = ffi.dlopen("libgcrypt.so")
pw=ffi.new("char []", pw_string.encode('UTF-8'))
if isinstance(pw_string, str):
pw_byte = pw_string.encode('UTF-8')
else:
pw_byte = pw_string
pw=ffi.new("char []", pw_byte)
salt = ffi.new("char []", salt_byte)
kb = ffi.new("char []", 32)
r = libgcrypt.gcry_kdf_derive(pw, len(pw_string), GCRY_KDF_ITERSALTED_S2K,