byteutils - cannot instantiate: 'N'
Closed this issue · 3 comments
S3cur3Th1sSh1t commented
Hey,
i just tried to use the function hexToByteArray from byteutils which throws the following error:
\stew-0.1.0\stew\byteutils.nim(61, 22) Error: cannot instantiate: 'N'
Some idea how to fix this?
Greetings
S3cur3Th1sSh1t commented
fromHex() runs fine but returns an byte sequence. I'm actually needing a byte array like this
var bytearray: array[22, byte]
S3cur3Th1sSh1t commented
Ok i didn´t need the mentioned array, a byte sequence was fine :)
jangko commented
hexToByteArray
offers 3 variants, one of them requires N to be specified at compile time. e.g. hexToByteArray[22](hexStr)
.
But you can also use:
var bytearray: array[22, byte]
hexToByteArray(hexStr, bytearray)
# or
hexToByteArray(hexStr, bytearray, 0, bytearray.high)