Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wklm
Created November 13, 2016 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wklm/56269dee40ead297c383a660d9cfdfc5 to your computer and use it in GitHub Desktop.
Save wklm/56269dee40ead297c383a660d9cfdfc5 to your computer and use it in GitHub Desktop.
let hexToByte x =
match x with
| '0' -> 0uy
| '1' -> 1uy
| '2' -> 2uy
| '3' -> 3uy
| '4' -> 4uy
| '5' -> 5uy
| '6' -> 6uy
| '7' -> 7uy
| '8' -> 8uy
| '9' -> 9uy
| 'a' -> 10uy
| 'b' -> 11uy
| 'c' -> 12uy
| 'd' -> 13uy
| 'e' -> 14uy
| 'f' -> 15uy
| _ -> failwith "invalid char"
let hexToBytes (x: string ) =
String.iter : hexToByte x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment