Created
December 9, 2017 20:16
-
-
Save Trinitek/8c616fd2f63094579cbb03e28b9ee202 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string BytesAsString(byte[] input) | |
| { | |
| var sb = new StringBuilder(); | |
| sb.Append("{\n "); | |
| int i; | |
| for (i = 0; i < input.Length; i++) | |
| { | |
| sb.Append($"0x{input[i]:x2}"); | |
| if (i < input.Length - 1) | |
| { | |
| sb.Append(", "); | |
| } | |
| if ((i + 1) % 16 == 0 && i < input.Length - 1) | |
| { | |
| sb.Append("\n "); | |
| } | |
| } | |
| sb.Append("\n}"); | |
| return sb.ToString(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment