bcgit / pc-dart

Pointy Castle - Dart Derived Bouncy Castle APIs
MIT License
237 stars 122 forks source link

Fortuna SecureRandom nextBigInt wrong bitLength #100

Open mx1up opened 3 years ago

mx1up commented 3 years ago

Hi,

Asking the nextBigInt with a certain bit length on the fortuna secure random does not always yield an int of the requested bit length. Is this normal?

I wrote a test to demonstrate: https://github.com/mx1up/pc-dart/commit/a148d66ff7ca096fb87e77047846ddac6b4f5732

sample output

0
1
2

Expected: <256>
  Actual: <254>

please have a look