Added a SecureRandom implementation based on darts own Random class.#110
Added a SecureRandom implementation based on darts own Random class.#110EP-u-NW wants to merge 1 commit intobcgit:masterfrom
Conversation
|
(Copied from RSA keygen issue) The issue is that Dart's random (even Random.secure()) is non-specified and thus somewhat dangerous to rely on for cryptographic purposes. I think that the benefit probably outweighs this (relatively nitpicky) concern, but Fortuna is not significantly slower than Random.secure() anyways, so there wouldn't be a performance bottleneck there. |
|
Hm I think it really comes down to trust here:
The question is now: Do we trust this statement? As a developer not specalized in cryptographic, I didn't know which random to pick when I started using pointycastle. I did not understand why I could not use the |
|
Hi, Has this been tested on nodeJS? https://api.dart.dev/stable/2.10.5/dart-math/Random/Random.secure.html Will throw an UnsupportedError on if it cannot find one. MW |
|
I don't really see how this differs from PlatformEntropySource... Isn't the whole point of that class to provide bytes from Random.secure() on native and node's thing otherwise? @mwcw any thoughts on that? |
|
It was actually not tested on node. And you are correct, instantiating a But what @AKushWarrior is saying is also interessting: The |
As discussed in #102 I added an implementation of
SecureRandombased on darts own Random. I saw that pointycastle already features a SecureRandomBase which does all random operations based on thenextUint8()function, so I opted to use this instead of theByteBasedSecureRandomI proposed in #102.I think having a random based on darts own
Randomimplementation is useful, since the dart team might have done some optimizations on vm level for random number generation.I additionally provided tests.