In javascript, I can get the hex string of a Uint8Array by wrapping it in a Buffer(int_array).toString(‘hex’).
I’m looking for an OCaml equivalent where I can instantiate a byte array like below. Is there a Bytes method that does what new Uint8Array
does directly? It looks like I have to init a bytes array of a specific length, and then iterate through it to set each value.
const publicKeyArr = new Uint8Array([
247, 115, 126, 69, 180, 61, 206, 136, 176, 58, 14, 251, 163, 119, 183, 51, 220, 33, 166, 85,
89, 253, 169, 240, 21, 195, 83, 35, 55, 135, 118, 25, 39, 83, 236, 186, 20, 8, 154, 3, 37,
183, 120, 143, 237, 114, 101, 86, 143, 148, 63, 227, 245, 95, 115, 138, 121, 34, 79, 69, 21,
209, 61, 76,
])
const buffHexString = new Buffer(publicKeyArr).toString('hex') // desired state
My end goal is to produce a string that is hashed by keccak256 to eventually produce an ethereum address from an ECDSA public key.