Open abhay-s-rawat opened 1 year ago
You can probably just inherit https://github.com/hivedb/hive/blob/master/hive/lib/src/crypto/hive_cipher.dart and pass in your own cipher.
Well bountycastle AES is bit slow, I just wanted to make things fast then I came to know about few packages like webcrypto,better_cryptography, webcrypto is super fast but support only 4 platforms for rest I can use better_cryptography. I was thinking a way to use them in this package.
On Fri, Mar 17, 2023 at 2:36 PM Nicolas Werner @.***> wrote:
You can probably just inherit https://github.com/hivedb/hive/blob/master/hive/lib/src/crypto/hive_cipher.dart and pass in your own cipher.
— Reply to this email directly, view it on GitHub https://github.com/hivedb/hive/issues/1171#issuecomment-1473462016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUIPCBFINZOGY736IHYF7TLW4QSQNANCNFSM6AAAAAAV42WRBQ . You are receiving this because you authored the thread.Message ID: @.***>
When I was creating a custom HiveCipher implementation ,some of the overrides like encrypt are sync and most of the AES implementations are async.
Regards, Abhay
On Sat, Mar 18, 2023 at 3:00 PM Abhay Rawat @.***> wrote:
Well bountycastle AES is bit slow, I just wanted to make things fast then I came to know about few packages like webcrypto,better_cryptography, webcrypto is super fast but support only 4 platforms for rest I can use better_cryptography. I was thinking a way to use them in this package.
On Fri, Mar 17, 2023 at 2:36 PM Nicolas Werner @.***> wrote:
You can probably just inherit https://github.com/hivedb/hive/blob/master/hive/lib/src/crypto/hive_cipher.dart and pass in your own cipher.
— Reply to this email directly, view it on GitHub https://github.com/hivedb/hive/issues/1171#issuecomment-1473462016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUIPCBFINZOGY736IHYF7TLW4QSQNANCNFSM6AAAAAAV42WRBQ . You are receiving this because you authored the thread.Message ID: @.***>
Let me give the motive about what I am doing.
I tested encrypting a 358mb(AES_CBC 256 with SHA256 HMAC) file and following are packages that I used to encrypt
webcrypto => 2 seconds => ios/linux/web/android better_cryptography => 8 seconds cryptography => 10 seconds
I am thinking to create a AES implementation which will use webcrypto on 4 platforms and switch to better_cryptography on mac and windows,
Xchacha20 implementations were even slower than aes.
Regards, Abhay
On Sat, Mar 18, 2023 at 5:24 PM Abhay Rawat @.***> wrote:
When I was creating a custom HiveCipher implementation ,some of the overrides like encrypt are sync and most of the AES implementations are async.
Regards, Abhay
On Sat, Mar 18, 2023 at 3:00 PM Abhay Rawat @.***> wrote:
Well bountycastle AES is bit slow, I just wanted to make things fast then I came to know about few packages like webcrypto,better_cryptography, webcrypto is super fast but support only 4 platforms for rest I can use better_cryptography. I was thinking a way to use them in this package.
On Fri, Mar 17, 2023 at 2:36 PM Nicolas Werner @.***> wrote:
You can probably just inherit https://github.com/hivedb/hive/blob/master/hive/lib/src/crypto/hive_cipher.dart and pass in your own cipher.
— Reply to this email directly, view it on GitHub https://github.com/hivedb/hive/issues/1171#issuecomment-1473462016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUIPCBFINZOGY736IHYF7TLW4QSQNANCNFSM6AAAAAAV42WRBQ . You are receiving this because you authored the thread.Message ID: @.***>
I tried all other AES implementations but the above were the best.
Currently with hive no encryption 1 Lakh records: 173 ms for box to open 3 Lakh records: 553 ms for box to open 5 Lakh records: 1696 ms for box to open => 22895Kb db file
Currently with hive default encryption 3 Lakh records: 1038 ms for box to open 5 Lakh records: 1962 ms for box to open => 37590Kb db file
That's why I am thinking of trying with the above implementations.
On Sat, Mar 18, 2023 at 5:30 PM Abhay Rawat @.***> wrote:
Let me give the motive about what I am doing.
I tested encrypting a 358mb(AES_CBC 256 with SHA256 HMAC) file and following are packages that I used to encrypt
webcrypto => 2 seconds => ios/linux/web/android better_cryptography => 8 seconds cryptography => 10 seconds
I am thinking to create a AES implementation which will use webcrypto on 4 platforms and switch to better_cryptography on mac and windows,
Xchacha20 implementations were even slower than aes.
Regards, Abhay
On Sat, Mar 18, 2023 at 5:24 PM Abhay Rawat @.***> wrote:
When I was creating a custom HiveCipher implementation ,some of the overrides like encrypt are sync and most of the AES implementations are async.
Regards, Abhay
On Sat, Mar 18, 2023 at 3:00 PM Abhay Rawat < @.***> wrote:
Well bountycastle AES is bit slow, I just wanted to make things fast then I came to know about few packages like webcrypto,better_cryptography, webcrypto is super fast but support only 4 platforms for rest I can use better_cryptography. I was thinking a way to use them in this package.
On Fri, Mar 17, 2023 at 2:36 PM Nicolas Werner @.***> wrote:
You can probably just inherit https://github.com/hivedb/hive/blob/master/hive/lib/src/crypto/hive_cipher.dart and pass in your own cipher.
— Reply to this email directly, view it on GitHub https://github.com/hivedb/hive/issues/1171#issuecomment-1473462016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUIPCBFINZOGY736IHYF7TLW4QSQNANCNFSM6AAAAAAV42WRBQ . You are receiving this because you authored the thread.Message ID: @.***>
Currently with hive 3 default encryption 5 Lakh records: 2800 ms for box to open => 37590Kb db file
On Sat, Mar 18, 2023 at 5:46 PM Abhay Rawat @.***> wrote:
I tried all other AES implementations but the above were the best.
Currently with hive no encryption 1 Lakh records: 173 ms for box to open 3 Lakh records: 553 ms for box to open 5 Lakh records: 1696 ms for box to open => 22895Kb db file
Currently with hive default encryption 3 Lakh records: 1038 ms for box to open 5 Lakh records: 1962 ms for box to open => 37590Kb db file
That's why I am thinking of trying with the above implementations.
On Sat, Mar 18, 2023 at 5:30 PM Abhay Rawat @.***> wrote:
Let me give the motive about what I am doing.
I tested encrypting a 358mb(AES_CBC 256 with SHA256 HMAC) file and following are packages that I used to encrypt
webcrypto => 2 seconds => ios/linux/web/android better_cryptography => 8 seconds cryptography => 10 seconds
I am thinking to create a AES implementation which will use webcrypto on 4 platforms and switch to better_cryptography on mac and windows,
Xchacha20 implementations were even slower than aes.
Regards, Abhay
On Sat, Mar 18, 2023 at 5:24 PM Abhay Rawat < @.***> wrote:
When I was creating a custom HiveCipher implementation ,some of the overrides like encrypt are sync and most of the AES implementations are async.
Regards, Abhay
On Sat, Mar 18, 2023 at 3:00 PM Abhay Rawat < @.***> wrote:
Well bountycastle AES is bit slow, I just wanted to make things fast then I came to know about few packages like webcrypto,better_cryptography, webcrypto is super fast but support only 4 platforms for rest I can use better_cryptography. I was thinking a way to use them in this package.
On Fri, Mar 17, 2023 at 2:36 PM Nicolas Werner < @.***> wrote:
You can probably just inherit https://github.com/hivedb/hive/blob/master/hive/lib/src/crypto/hive_cipher.dart and pass in your own cipher.
— Reply to this email directly, view it on GitHub https://github.com/hivedb/hive/issues/1171#issuecomment-1473462016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUIPCBFINZOGY736IHYF7TLW4QSQNANCNFSM6AAAAAAV42WRBQ . You are receiving this because you authored the thread.Message ID: @.***>
Is your feature request related to a problem? Please describe. larger hive boxes that are ecnypted are slow.
Describe the solution you'd like If we can use xchacha we can improve laoding speeds of huge boxes which are encrypted by several times.
Describe alternatives you've considered A way to choose xchacha20 as encryption algo.
I can give a try if you can give a hint about how to do it and will add pull request.