BouncyCastle SCrypt using more memory than native impls?
Andreas Schildbach <[email protected]> Sat, 20 Jul 2019 12:06:37 +0200
| Newsgroups | gmane.comp.encryption.bouncy-castle.devel |
|---|---|
| Message-ID | <[email protected]> |
I recently switched out the SCrypt implementation in my app. I had been using native code: https://github.com/wg/scrypt. For reference, the code I had been using was removed via this commit: https://github.com/bitcoin-wallet/bitcoin-wallet/commit/83210d60461182188be8e13133a9bee40eefd1da I'm now using BouncyCastle org.spongycastle.crypto.generators.SCrypt (artifact: org.bouncycastle:bcprov-jdk15on:1.60) I now have the problem that on low-end Android devices my app gets a lot of OutOfMemoryErrors. I wonder if the BouncyCastle implementation somehow uses more memory than it should, e.g. by copying buffers? Is this maybe a known problem? I scanned the BCs issues at GitHub but didn't find much about SCrypt at all. By the way: on modern Android devices (Pixel 2, Android 9, 64 bit) the BouncyCastle implementation actually runs faster than the native code before!