Convert a binary string to Hexadecimal and vice-versa in Elixir
问题 How do you convert a binary string to a Hexadecimal String and vice-versa in Elixir? There are a few posts on SO regarding this topic for other "main stream" languages. There's even an SO post that benchmarks various C# implementations How do we do this in elixir? My implementation was too ugly to share... :( 回答1: There is Base.encode16/2: iex(1)> Base.encode16("foo") "666F6F" You can also specify the case: iex(2)> Base.encode16("foo", case: :lower) "666f6f" 来源: https://stackoverflow.com