Cryptography/CafeLib.Cryptography.UnitTests/BsvSharp/Passphrase/Mnemonic.cs
/// <summary>
/// Returns the entropy as a byte[] from a string of base 6 digits.
/// Verifies that there are at least length / Log2(6) rounded up digits in string.
/// This is 50 digits for 128 bits, 100 digits for 256 bits.
/// The string must use digits 0-9.
/// </summary>
/// <param name="base10">The string must use digits 0-9.</param>
/// <param name="length">Optional entropy length in bits. Must be a multiple of 8.</param>
/// <returns>Returns the entropy as a byte[] from a string of base 10 digits.</returns>
Returns the entropy as a byte[] from a string of base 6 digits.
Verifies that there are at least length / Log2(6) rounded up digits in string.
This is 50 digits for 128 bits, 100 digits for 256 bits.
The string must use digits 0-9.
Returns the entropy as a byte [] from a string of base 6 digits . Verifies that there are at least length / Log2 ( 6 ) rounded up digits in string . This is 50 digits for 128 bits 100 digits for 256 bits . The string must use digits 0 - 9 .
private static byte[] Base10ToEntropy(string base10, int length = 128)
		{
			var needDigits = (int)Math.Ceiling(length / Math.Log(10, 2));
			if (base10.Length < needDigits)
				throw new ArgumentException($"For {length} bits of entropy, at least {needDigits} digits of base 10 are needed.");
			return BigIntegerToEntropy(Base10ToBigInteger(base10), length);
		}
private static byte [ ] Base10ToEntropy ( string base10 , int length = 128 ) { var needDigits = ( int ) Math . Ceiling ( length / Math . Log ( 10 , 2 ) ) ; if ( base10 . Length < needDigits ) throw new ArgumentException ( $" For  { length }  bits of entropy, at least  { needDigits }  digits of base 10 are needed. " ) ; return BigIntegerToEntropy ( Base10ToBigInteger ( base10 ) , length ) ; }
Returns the entropy as a byte[] from a string of base 6 digits.
Returns the entropy as a byte [] from a string of base 6 digits .
Returns the entropy as a byte[] from a string of base 10 digits.
Returns the entropy as a byte [] from a string of base 10 digits .
base10
string
The string must use digits 0-9.
The string must use digits 0 - 9 .
length
int
Optional entropy length in bits. Must be a multiple of 8.
Optional entropy length in bits . Must be a multiple of 8 .