Cryptography/CafeLib.Cryptography.UnitTests/BsvSharp/Passphrase/Mnemonic.cs
/// <summary>
/// Returns low order digits of a BigInteger as a byte array length / 8 bytes.
/// CAUTION: Will pad array with zero bytes if number is small.
/// </summary>
/// <param name="big"></param>
/// <param name="length"></param>
/// <returns></returns>
Returns low order digits of a BigInteger as a byte array length / 8 bytes.
CAUTION: Will pad array with zero bytes if number is small.
Returns low order digits of a BigInteger as a byte array length / 8 bytes . CAUTION : Will pad array with zero bytes if number is small .
private static byte[] BigIntegerToEntropy(BigInteger big, int length = 128)
		{
			if (length % 8 != 0)
				throw new ArgumentException("length must be a multiple of eight.");
			var bytes = big.ToByteArray();
			var count = length / 8;
			if (bytes.Length > count)
				bytes = bytes.Take(count).ToArray();
			if (bytes.Length < count)
				bytes = new byte[count - bytes.Length].Concat(bytes).ToArray();
			return bytes;
		}
private static byte [ ] BigIntegerToEntropy ( BigInteger big , int length = 128 ) { if ( length % 8 != 0 ) throw new ArgumentException ( " " ) ; var bytes = big . ToByteArray ( ) ; var count = length / 8 ; if ( bytes . Length > count ) bytes = bytes . Take ( count ) . ToArray ( ) ; if ( bytes . Length < count ) bytes = new byte [ count - bytes . Length ] . Concat ( bytes ) . ToArray ( ) ; return bytes ; }
Returns low order digits of a BigInteger as a byte array length / 8 bytes.
Returns low order digits of a BigInteger as a byte array length / 8 bytes .
None
big
BigInteger
None
length
int
None