diff --git a/Makefile b/Makefile
index b36057cc..a8026430 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ CFLAGS += \
ANDROID_BUILD_TOOLS := $(ANDROID_SDK)/build-tools/34.0.0
ANDROID_PLATFORM := $(ANDROID_SDK)/platforms/android-33
ANDROID_NDK ?= $(ANDROID_SDK)/ndk/26.0.10792818
-ANDROID_MIN_SDK_VERSION := 28
+ANDROID_MIN_SDK_VERSION := 26
ANDROID_ARMV7A_TARGETS := \
out/androiddebug-armv7a/tildefriends \
@@ -691,7 +691,7 @@ release-apk: out/TildeFriends-arm-release.apk out/TildeFriends-x86-release.apk
.PHONY: release-apk
releaseapkgo: out/TildeFriends-arm-release.apk
- @adb install $<
+ @adb install -r $<
@adb shell am start com.unprompted.tildefriends/.MainActivity
.PHONY: releaseapkgo
diff --git a/src/android/AndroidManifest.xml b/src/android/AndroidManifest.xml
index 39d021cc..bf6279cb 100644
--- a/src/android/AndroidManifest.xml
+++ b/src/android/AndroidManifest.xml
@@ -3,7 +3,7 @@
package="com.unprompted.tildefriends"
android:versionCode="12"
android:versionName="0.0.12-wip">
-
+
diff --git a/src/bcrypt.js.c b/src/bcrypt.js.c
index 2e59793a..7a0f3dd8 100644
--- a/src/bcrypt.js.c
+++ b/src/bcrypt.js.c
@@ -1,23 +1,12 @@
#include "bcrypt.js.h"
+#include "task.h"
+
#include "ow-crypt.h"
#include "quickjs.h"
-#if defined(_WIN32)
-#define WIN32_LEAN_AND_MEAN
-#include
-extern BOOLEAN NTAPI SystemFunction036(PVOID Buffer, ULONG BufferLength);
-#elif __APPLE__
-#include
-#if TARGET_OS_IPHONE
-#include
-#else
-#include
-#endif
-#else
-#include
-#endif
+#include
JSValue _crypt_hashpw(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv);
JSValue _crypt_gensalt(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv);
@@ -49,19 +38,8 @@ JSValue _crypt_gensalt(JSContext* context, JSValueConst this_val, int argc, JSVa
int length = 0;
JS_ToInt32(context, &length, argv[0]);
char buffer[16];
-#if defined(_WIN32)
- ssize_t bytes = SystemFunction036(buffer, sizeof(buffer)) ? sizeof(buffer) : 0;
-#elif defined(__APPLE__) && TARGET_OS_IPHONE
- ssize_t bytes = CCRandomGenerateBytes(buffer, sizeof(buffer)) == kCCSuccess ? sizeof(buffer) : 0;
-#elif defined(__APPLE__) && !TARGET_OS_IPHONE
- ssize_t bytes = 0;
- if (getentropy(buffer, sizeof(buffer)) == 0)
- {
- bytes = sizeof(buffer);
- }
-#else
- ssize_t bytes = getrandom(buffer, sizeof(buffer), 0);
-#endif
+ tf_task_t* task = tf_task_get(context);
+ size_t bytes = uv_random(tf_task_get_loop(task), &(uv_random_t) { 0 }, buffer, sizeof(buffer), 0, NULL) == 0 ? sizeof(buffer) : 0;
char output[7 + 22 + 1];
char* salt = crypt_gensalt_rn("$2b$", length, buffer, bytes, output, sizeof(output));
JSValue result = JS_NewString(context, salt);