diff --git a/README.md b/README.md index 559295f..aff3be5 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,11 @@ Simple wrapper around argon2 for usage in https://github.com/authpass/kdbx.dart ## To compile +(Use cmake from android sdk `sdk/cmake/3.10.2.4988404/bin/cmake`) + ``` cd ios/Classes +cmake . cmake --build . ``` diff --git a/ios/Classes/argon2_ffi.c b/ios/Classes/argon2_ffi.c index 63c43d3..4f7f8bd 100644 --- a/ios/Classes/argon2_ffi.c +++ b/ios/Classes/argon2_ffi.c @@ -4,6 +4,8 @@ #include #include "argon2src/argon2.h" +//#include + //extern "C" __attribute__((visibility("default"))) __attribute__((used)) int32_t native_add(int32_t x, int32_t y) { return x + y; @@ -17,6 +19,8 @@ int32_t native_add(int32_t x, int32_t y) { #define DEBUG 0 #define PRINT_DEBUG(fmt, ...) \ do { if (DEBUG) printf(fmt, ##__VA_ARGS__); } while (0) +//#define PRINT_DEBUG(fmt, ...) \ +// do { if (DEBUG) __android_log_print(ANDROID_LOG_VERBOSE, "argon2ffi", fmt, ##__VA_ARGS__); } while (0) // base64 encoding https://nachtimwald.com/2017/11/18/base64-encode-and-decode-in-c/ @@ -96,14 +100,14 @@ void debugBytes(uint8_t *bytes, int length) { } } -char *hp_argon2_hash(uint8_t *key, size_t keylen, uint8_t *salt, size_t saltlen, +char *hp_argon2_hash(uint8_t *key, uint32_t keylen, uint8_t *salt, uint32_t saltlen, uint32_t m_cost, uint32_t t_cost /* iterations*/, uint32_t parallelism, - size_t hashlen, + uint32_t hashlen, uint8_t type, int32_t version) { uint8_t hash1[hashlen]; - PRINT_DEBUG("keylen: %ld, saltlen: %ld, m_cost: %ld, t_cost: %ld, hashlen: %ld, type: %d, version: %02x\n", - keylen, saltlen, m_cost, t_cost, hashlen, type, version); + PRINT_DEBUG("keylen: %ld, saltlen: %ld, m_cost: %ld, t_cost: %ld, parallelism: %ld, hashlen: %ld, type: %d, version: %02x\n", + keylen, saltlen, m_cost, t_cost, parallelism, hashlen, type, version); PRINT_DEBUG("key: "); debugBytes(key, keylen);