feat: replace libsodium with pure Kotlin ChaCha20/Poly1305 implementation
Remove LazySodium/JNA/libsodium native dependencies and replace with pure Kotlin implementations of ChaCha20, HChaCha20, XChaCha20, Poly1305 MAC, and XChaCha20-Poly1305 AEAD. This eliminates platform- specific native binaries while maintaining full NIP-44 compatibility. - Add ChaCha20Core with RFC 8439 block function, IETF stream XOR, HChaCha20, and XChaCha20 - Add Poly1305 MAC (RFC 8439 §2.5) - Add XChaCha20Poly1305 AEAD encrypt/decrypt - Convert LibSodiumInstance from expect/actual to commonMain object - Delete platform-specific LibSodiumInstance actuals (android/jvm/ios) - Remove iOS native interop (cinterop, linker opts, .a libraries) - Remove lazysodium-java, lazysodium-android, JNA from build deps - Clean up ProGuard rules (remove JNA/LazySodium keep rules) - Add RFC 8439 + libsodium test vectors for ChaCha20 and XChaCha20 - Update benchmark to use simplified ChaCha20 API https://claude.ai/code/session_01YHBwqnb3Z7Q7PX31tJ2G3i
This commit is contained in:
+4
-24
@@ -52,36 +52,16 @@ class ChaCha20Benchmark {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun encryptLibSodium() {
|
||||
fun encrypt() {
|
||||
benchmarkRule.measureRepeated {
|
||||
chaCha.encryptLibSodium(padded, messageKeys.chachaNonce, messageKeys.chachaKey)
|
||||
chaCha.encrypt(padded, messageKeys.chachaNonce, messageKeys.chachaKey)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Removed in the conversion to KMP
|
||||
@Test
|
||||
fun encryptNative() {
|
||||
fun decrypt() {
|
||||
benchmarkRule.measureRepeated {
|
||||
chaCha.encryptNative(padded, messageKeys.chachaNonce, messageKeys.chachaKey)
|
||||
chaCha.decrypt(padded, messageKeys.chachaNonce, messageKeys.chachaKey)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
fun decryptLibSodium() {
|
||||
benchmarkRule.measureRepeated {
|
||||
chaCha.decryptLibSodium(padded, messageKeys.chachaNonce, messageKeys.chachaKey)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Removed in the conversion to KMP
|
||||
@Test
|
||||
fun decryptNative() {
|
||||
benchmarkRule.measureRepeated {
|
||||
chaCha.decryptNative(padded, messageKeys.chachaNonce, messageKeys.chachaKey)
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user