Binaries and Bit Strings

Elixir is a language built on top of Erlang, and Erlang was built to work on phone switches. As you might expect, Erlang is good at working with data down at the level of bits and bytes, and Elixir has inherited many of these capabilities. In this section, we’ll quickly cover the tools you can use if you ever find yourself working with low-level protocols like parsing a .jpg[16] image or taking apart a low-level TCPIP[17] header.

Binaries

Let’s dive a little deeper. At their lowest level, computers are about the flow of data, and that data is all made up of 1s and 0s. These bits represent a numerical format called binary. One binary digit is a bit. While decimal systems are made up of digits from 0 to 9, binary numbers ...

Get Programmer Passport: Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.