NativeCrypto
Fast crypto functions for Flutter.
Why 🤔
Because I faced a performance issue when I was using PointyCastle.
It's quite simple, judge for yourself, these are times for AES256 encryption on an Android device.
Size | PointyCastle |
---|---|
100 kB | 190 ms |
200 kB | 314 ms |
300 kB | 1138 ms |
400 kB | 2781 ms |
500 kB | 4691 ms |
600 kB | 7225 ms |
700 kB | 10264 ms |
800 kB | 13582 ms |
900 kB | 17607 ms |
We notice that these times, in addition to being far too big, are not even linear.
Performances ⏱
Size | NativeCrypto |
---|---|
1 mB | 27 ms |
2 mB | 43 ms |
3 mB | 78 ms |
4 mB | 93 ms |
5 mB | 100 ms |
10 mB | 229 ms |
50 mB | 779 ms |
How 🔬
Using the native implementation of the crypto libs available on each OS.
For Android:
For iOS:
Todo 🚀
- ✅ Implement working cross platform encryption/decryption.
- Complete AES implementation (all key sizes, padding, modes...).
- Improve performances.
- Add ChaCha20.
- ... add asym crypto support.
Description
Languages
Dart
67.2%
Java
15%
Kotlin
8.2%
Swift
8.1%
Ruby
0.7%
Other
0.8%