Logo

Programming-Idioms

History of Idiom 175 > diff from v6 to v7

Edit summary for version 7 by steenslag:
[Ruby] Forgot to assign to s

Version 6

2019-01-05, 23:52:11

Version 7

2019-01-06, 00:09:44

Idiom #175 Bytes to hex string

From array a of n bytes, build the equivalent hex string s of 2n digits.
Each byte (256 possible values) is encoded as two hexadecimal characters (16 possible values per digit).

Idiom #175 Bytes to hex string

From array a of n bytes, build the equivalent hex string s of 2n digits.
Each byte (256 possible values) is encoded as two hexadecimal characters (16 possible values per digit).

Extra Keywords
hexa
Extra Keywords
hexa
Code
a.unpack("H*")
Code
s = a.unpack("H*")
Demo URL
http://codepad.org/aTBnKYw6
Demo URL
http://codepad.org/aTBnKYw6