Skip to content

Instantly share code, notes, and snippets.

@jerhon
Last active January 2, 2023 23:10
Show Gist options
  • Save jerhon/5cccbf76a65615da4e1dde08e8b719b4 to your computer and use it in GitHub Desktop.
Save jerhon/5cccbf76a65615da4e1dde08e8b719b4 to your computer and use it in GitHub Desktop.
Hex Operations in C#
public static class HexOps {
public static byte[] ToBytesFromHex(string hex) {
byte[] ret = new byte[hex.Length];
for (int i = 0; i < hex.Length; i++) {
ret[i] = Convert.ToByte(hex[i]);
}
return ret;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment