PointyCastle / pointycastle

Moved into the Bouncy Castle project: https://github.com/bcgit/pc-dart
MIT License
270 stars 76 forks source link

Scrypt function optimization #185

Open christophewang opened 5 years ago

christophewang commented 5 years ago

The speed/performance for scrypt function is quite slow when I use it. In my case, I use those scrypt parameters (n=16384, r=8, p=8). It takes about ~15sec when I do one key derivation. In comparison on the same machine, in Javascript, it takes only ~ 2sec.

Is there a way to optimize that ?

stevenroose commented 5 years ago

What environment are you testing that in, DartVM or dart2js? I was not the one that implemented Scrypt, but I believe the implementation was based on a Java one, not a JS one.

christophewang commented 5 years ago

I tested it in the DartVM. Yes, I mentioned JS as a comparison only. I also tried the one from BouncyCastle (Java) with the same scrypt parameters and it took around ~1sec.

My use case is for Bitcoin BIP38 private key encryption/decryption, I can try to provide more details if you need.

stevenroose commented 5 years ago

I'm really not actively maintaining this library anymore, I'm sorry. I think I had an e-mail from you about BIP38, I replied to that this morning.