Cryptography/CafeLib.Cryptography.UnitTests/BsvSharp/Passphrase/Mnemonic.cs
/// <summary>
/// Splits a binary string into its data and checksum parts.
/// Converts the data to an array of bytes.
/// Returns (data as byte[], checksum as binary string).
/// </summary>
/// <param name="bin">Binary string to be split.</param>
/// <returns>Returns (data as byte[], checksum as binary string).</returns>
Splits a binary string into its data and checksum parts.
Converts the data to an array of bytes.
Returns (data as byte[], checksum as binary string).
Splits a binary string into its data and checksum parts . Converts the data to an array of bytes . Returns ( data as byte [] checksum as binary string ) .
private static (byte[], string) BinaryStringToDataAndChecksum(string bin)
        {
            var cs = bin.Length / 33; 
            var checksum = bin.Substring(bin.Length - cs);
            var dataBits = bin.Substring(0, bin.Length - cs);
            var data = ConvertBinaryStringToBytes(dataBits);
            return (data, checksum);
        }
private static ( byte [ ] , string ) BinaryStringToDataAndChecksum ( string bin ) { var cs = bin . Length / 33 ; var checksum = bin . Substring ( bin . Length - cs ) ; var dataBits = bin . Substring ( 0 , bin . Length - cs ) ; var data = ConvertBinaryStringToBytes ( dataBits ) ; return ( data , checksum ) ; }
Splits a binary string into its data and checksum parts.
Splits a binary string into its data and checksum parts .
// one bit of checksum for every 32 bits of data.
Returns (data as byte[], checksum as binary string).
Returns ( data as byte [] checksum as binary string ) .
bin
string
Binary string to be split.
Binary string to be split .