public static GenPrivateKey ( int maxNum, int bitsCount = DefaultBitsCount ) : |
||
maxNum | int | |
bitsCount | int | |
return |
public static PrivateKey GenPrivateKey(int maxNum, int bitsCount = DefaultBitsCount)
{
var buff = new byte[bitsCount/8];
while(true)
{
Singleton.Random.NextBytes(buff);
var p = BigInteger.Abs(new BigInteger(buff));
return new PrivateKey { Key = p, MaxNum = maxNum};
}
}