Hex encoding functions on the binary module

Bryan Frimin bryan@REDACTED
Fri Jan 29 20:00:25 CET 2021

Hello everyone,

I propose to add the encode_hex/1, encode_hex/2 and decode_hex/1
functions on the binary module[1].

Dealing with the hex format is frequent in many codebases. At this time,
we all copy-paste similar helpers in our codebases to encode and decode
a hex-encoded binary.

It's why I suggest enriching the binary module with these functions.

I've added these functions on the binary module because it makes sense
to me, and it avoids polluting the global namespace with a new
module. Maybe create a new module called hex, for example, is a better

I tried as much as possible to follow the contribution guide. Don't
hesitate to tell me if I made a mistake somewhere.


Bryan Frimin

[1] https://github.com/erlang/otp/pull/3014

More information about the erlang-questions mailing list