Function Resource

ByteArrayToBitList

Converts a byte array to a list of bits.

Contributed by: Arnoud Buzing

ResourceFunction["ByteArrayToBitList"][ba]

converts ByteArray ba to a list of bits.

Details and Options

The output typically requires 64 times more memory than the input.

Examples

Basic Examples

Create a byte array:

In[1]:=
ba = ByteArray[RandomInteger[{0, 255}, 20]]
Out[1]=

Convert to individual bits:

In[2]:=
bits = ResourceFunction[ "https://www.wolframcloud.com/obj/arnoudb/DeployedResources/\
Function/ByteArrayToBitList"][ba]
Out[2]=

Compare the number of bytes needed to represent the expressions:

In[3]:=
ByteCount /@ {bits, ba}
Out[3]=