BitsAndBytes

public static class BitsAndBytes
Provides conversion methods for bit and byte arrays to and from strings.

Methods

BitArrayToString

#
public static string BitArrayToString(BitArray bits)
Convert a bitarray to a sequence of '0' and '1' characters.
bits (BitArray)Bits to format.
A string representing the bit array.

ByteArrayToString

#
public static string ByteArrayToString(byte[] bytes, HashFormat format)
Convert a byte array to a string.
bytes (byte[])Bytes to encode.
format (HashFormat)Formatting options.
A string representing the byte array.

StringToBitArray

#
public static BitArray StringToBitArray(string text)
Convert a string created with the BitArrayToString method back into a bit array.
text (string)String to convert.
The bit array that was represented by the string.

StringToByteArray

#
public static byte[] StringToByteArray(string text, HashFormat format)
Convert a string to a byte array.
text (string)String to decode.
format (HashFormat)Formatting options.
The byte array represented by the string.