diff --git a/lib/src/crypto/argon2.dart b/lib/src/crypto/argon2.dart index ac3df28..dc30d80 100644 --- a/lib/src/crypto/argon2.dart +++ b/lib/src/crypto/argon2.dart @@ -7,16 +7,15 @@ import 'package:ffi_helper/ffi_helper.dart'; import 'package:meta/meta.dart'; // ignore_for_file: non_constant_identifier_names - typedef Argon2HashNative = Pointer Function( Pointer key, - IntPtr keyLen, + Uint32 keyLen, Pointer salt, - Uint64 saltlen, + Uint32 saltlen, Uint32 m_cost, // memory cost Uint32 t_cost, // time cost (number iterations) Uint32 parallelism, - IntPtr hashlen, + Uint32 hashlen, Uint8 type, Uint32 version, ); @@ -61,10 +60,10 @@ abstract class Argon2Base extends Argon2 { @override Uint8List argon2(Argon2Arguments args) { final keyArray = Uint8Array.fromTypedList(args.key); -// final saltArray = Uint8Array.fromTypedList(salt); - final saltArray = allocate(count: args.salt.length); - final saltList = saltArray.asTypedList(args.length); - saltList.setAll(0, args.salt); + final saltArray = Uint8Array.fromTypedList(args.salt); +// final saltArray = allocate(count: args.salt.length); +// final saltList = saltArray.asTypedList(args.length); +// saltList.setAll(0, args.salt); // const memoryCost = 1 << 16; // _logger.fine('saltArray: ${ByteUtils.toHexList(saltArray.view)}'); @@ -72,8 +71,8 @@ abstract class Argon2Base extends Argon2 { final result = argon2hash( keyArray.rawPtr, keyArray.length, - saltArray, - args.salt.length, + saltArray.rawPtr, + saltArray.length, args.memory, args.iterations, args.parallelism, @@ -83,8 +82,8 @@ abstract class Argon2Base extends Argon2 { ); keyArray.free(); -// saltArray.free(); - free(saltArray); + saltArray.free(); +// free(saltArray); final resultString = Utf8.fromUtf8(result); return base64.decode(resultString); } diff --git a/libargon2_ffi.dylib b/libargon2_ffi.dylib index 4c38cd6..7256eda 100755 Binary files a/libargon2_ffi.dylib and b/libargon2_ffi.dylib differ diff --git a/libargon2_ffi.so b/libargon2_ffi.so index 7f19c99..a10c7b8 100755 Binary files a/libargon2_ffi.so and b/libargon2_ffi.so differ