Why does toString(‘hex’) result in twice the bytes in Nodejs?

You are creating a hex-string from the raw-bytes – as far as I know characters of a string are stored in 16bit and since 16 bits equal 2 bytes (see this for more information), you get a total length of 64 for the resulting string. The length of the bytes-array will still be 32.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top