Created
March 6, 2018 18:55
-
-
Save umegaya/f0b93ff53faf466dbee28a93491e24e2 to your computer and use it in GitHub Desktop.
convert arbiter length of hexdump string "0x...." to byte array
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
var toBytes = (hexdump) => { | |
var buff = new Uint8Array(hexdump.length / 2 - 1); | |
var idx = 0; | |
hexdump.substring(2).replace(/\w{2}/g, (m) => { | |
buff[idx++] = parseInt(m, 16); | |
}); | |
return buff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment