HexaDump
Namespace: SnowBank.Text · class
Helper class for formatting binary blobs into hexadecimal for logging or troubleshooting
Methods
ComputeBytesDistribution
static string ComputeBytesDistribution(byte[] bytes, int shrink = 0)
Generate a string that represents the byte distribution (0..255) of a buffer
bytes— Buffer to mapshrink— Shrink factor between 0 and 8. The byte value is divided by 2^shrinkto get the index of the corresponding counter
Returns: ASCII string (of size 256 >> shrink) that shows the distribution of bytes
static string ComputeBytesDistribution(Slice bytes, int shrink = 0)
Generate a string that represents the byte distribution (0..255) of a buffer
bytes— Buffer to mapshrink— Shrink factor between 0 and 8. The byte value is divided by 2^shrinkto get the index of the corresponding counter
Returns: ASCII string (of size 256 >> shrink) that shows the distribution of bytes
static string ComputeBytesDistribution(ReadOnlySpan<byte> bytes, int shrink = 0)
Generate a string that represents the byte distribution (0..255) of a buffer
bytes— Buffer to mapshrink— Shrink factor between 0 and 8. The byte value is divided by 2^shrinkto get the index of the corresponding counter
Returns: ASCII string (of size 256 >> shrink) that shows the distribution of bytes
Format
static string Format(byte[] bytes, Options options = 0, int indent = 0)
Dumps a byte array into hexadecimal, formatted as 16 bytes per lines
static string Format(Slice bytes, Options options = 0, int indent = 0)
Dumps a byte slice into hexadecimal, formatted as 16 bytes per lines
static string Format(ReadOnlySpan<byte> bytes, Options options = 0, int indent = 0)
Dumps a byte span into hexadecimal, formatted as 16 bytes per lines
Versus
static string Versus(byte[] left, byte[] right, Options options = 0)
Dump two byte arrays, side-by-side, formatted as 16 bytes per line
static string Versus(Slice left, Slice right, Options options = 0)
Dump two byte slices, side-by-side, formatted as 16 bytes per line
static string Versus(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right, Options options = 0, int indent = 0)
Dump two byte spans, side-by-side, formatted as 16 bytes per line