Skip to content

bytes

raw bytes, as read from a file or built by hand

1
# bytes
2
b"\x7fELF\n"
3
# b then quotes
4
b"\x7fELF"
5
# from text
6
"hi".bytesb"hi"
Example outputCtrl+Enter to run
1
# b[i] is a byte's value
2
b"hi"[0]104
Example outputCtrl+Enter to run
  • wc count lines, words and bytes, like the Unix wc tool
  • hamming how many positions two equal-length strings differ at, the Hamming distance
  • encode encode bytes, or a string’s UTF-8 bytes, in the named format
  • decode_auto try every format decode knows, plus rot13, bytes written as binary, octal or decimal numbers, and single-byte XOR, layer on layer up to depth deep, and list the text that comes out, the most English-looking first
  • flag_find find CTF flags, prefix up to the next }, in bytes or text: as they are, and in what decode_auto’s decodings make of each run of printable text, up to 3 layers deep
  • bytes a string’s UTF-8 bytes, bytes made from a list of integers 0-255, or an integer’s bytes
  • int bytes read as one unsigned integer of any length, big-endian (most significant first) unless “little”
  • pkcs7_pad bytes padded to a multiple of size, 16 by default, with PKCS#7: n copies of the byte n, from 1 to size
  • pkcs7_unpad bytes with their PKCS#7 padding removed, checking it’s valid for blocks of size, 16 by default
  • from_bytes a string from UTF-8 bytes, given as bytes or as a list of integers
  • byte_len how many bytes the text takes in UTF-8, rather than how many characters it has
  • hexdump bytes shown as a hex dump, like the xxd tool, or just n bytes around address at
  • diff what changed from bytes a to b, by hex dump row, or nil if nothing did
  • bindiff what changed from bytes a to b as a table of offset, size, old and new, a row per run of changed bytes
  • find the offset of the first match of needle in bytes, or nil
  • find_all the offset of every match of needle in bytes, overlapping ones too
  • patch a copy of bytes with new written over them at offset
  • strings the readable text hidden in binary data: every run of at least min printable characters, like the Unix tool
  • entropy how unpredictable the bytes are (Shannon entropy)
  • crc32 the CRC-32 checksum, as an integer, the same one zip files and PNG images use
  • xor_solve find the repeating key that bytes were XORed with, assuming the plain text is English, and return {key, text}
  • freq how often each symbol appears in s, as a table of symbol, count and percent, the most common first
  • ngrams every run of n symbols in s with how often it appears, as a table of gram and count, the most common first
  • ioc the index of coincidence of s: the chance that two symbols picked from it at random are the same
  • chi_squared how far the letters of s are from English letter frequencies, as a chi-squared value, where lower is closer
  • friedman the length of a repeating key, estimated from the index of coincidence by Friedman’s formula
  • key_lengths each key length up to max with the average index of coincidence of the columns it splits s into, as a table of length and ioc, the highest first
  • kasiski the Kasiski examination of s: runs of n symbols that appear more than once, and the key lengths their distances point to, as {repeats, factors}
  • analyze a quick look at the statistics of s, as a map of length, symbols, entropy, ioc, chi_squared, top and likely
  • aes_encrypt encrypt with AES, the standard block cipher, in mode “ecb”, “cbc”, “ctr” or “gcm”
  • aes_decrypt decrypt AES, the reverse of aes_encrypt with the same key, mode and IV
  • des_encrypt encrypt with DES, or Triple DES given a 16- or 24-byte key, in mode “ecb”, “cbc” or “ctr”
  • des_decrypt decrypt DES or Triple DES, the reverse of des_encrypt
  • chacha20 encrypt or decrypt with ChaCha20 (RFC 8439), a 32-byte key and a 12-byte nonce, as the same call does both
  • rc4 encrypt or decrypt with RC4, as the same call does both
  • len how many items a list, map or set has, characters a string has, or bytes a bytes value has
  • rsa_encrypt textbook RSA encryption, m ** e mod n, with no padding
  • hex an integer in hex, the same as v to hex
  • u8 1 byte back to an integer from 0 to 255
  • u16 2 bytes back to a non-negative integer, lowest byte first, or highest first if order is “big”
  • u32 4 bytes back to a non-negative integer, lowest byte first, or highest first if order is “big”
  • u64 8 bytes back to a non-negative integer, lowest byte first, or highest first if order is “big”
  • xor xor each byte with the key, repeating the key as often as needed An int key is a single byte. Xor-ing again with the same key gives back the original. Between two ints, a xor b is a ^ b An int key is a single byte. Xor-ing again with the same key gives back the original
  • cyclic_find how many bytes into the cyclic pattern sub appears, or nil
  • binary read a compiled program or library (ELF, PE or Mach-O) into a map of what it is, what’s inside it and which security protections it was built with
  • disasm disassemble x86 or x64 machine code into assembly, laid out like objdump -d, or with table into a table of addr, bytes and text
  • gadgets find ROP gadgets: short runs of instructions ending in ret, the pieces a return-oriented exploit chains together when it can’t run code of its own
  • xrefs find the instructions in a binary that call, jump to or read from an address or symbol
  • magic what kind of file this is, from the signature bytes it starts with, like the file command
  • decompress uncompress bytes in any format this module knows (gzip, zlib, xz, zstd, bzip2, or raw deflate), picked by its signature
  • inflate uncompress raw deflate data, the format inside zip files, gzip and PNG images
  • deflate compress bytes with raw deflate, no header or checksum
  • gunzip uncompress gzip data, the .gz format, checking its CRC-32
  • gzip compress bytes into gzip, the .gz format
  • unzlib uncompress zlib data, deflate with a 2-byte header and an Adler-32 checksum, as in PDFs and PNG chunks
  • zlib compress bytes into zlib, deflate with a 2-byte header and an Adler-32 checksum
  • unxz uncompress xz data, the .xz format
  • xz compress bytes into xz, the .xz format
  • unzstd uncompress Zstandard data, the .zst format
  • zstd compress bytes into Zstandard, the .zst format, at its fastest level
  • bunzip2 uncompress bzip2 data, the .bz2 format
  • bzip2 compress bytes into bzip2, the .bz2 format
  • png_chunks the chunks of a PNG file as a table of offset, type, length, data, crc and crc_ok
  • exif the EXIF metadata of a JPEG, PNG or TIFF file as a map, like the camera, the time a photo was taken and where
  • pcap the packets in a pcap or pcapng capture, as Wireshark and tcpdump save them, as a table of time, src, dst, proto, sport, dport, len and payload
  • php_unserialize read PHP’s serialize() format into zil values
  • pickle_dis list the opcodes of a Python pickle, like pickletools.dis, as a table of offset, op and arg
  • entropy_map the entropy of each block of bytes, 256 by default, to spot compressed or encrypted regions in a file
  • unzip the files in a zip archive as a table of name, size, data, crc, encrypted and comment
  • zip_info the files listed in a zip archive, without unpacking them: name, size, packed, method, crc, encrypted and comment
  • untar the files in a tar archive as a table of name, size and data
  • un7z the files in a 7z archive as a table of name, size, data and crc
  • info_7z the files listed in a 7z archive, without unpacking them: name, size and crc
  • carve find the files embedded in bytes, like binwalk, by searching for every signature magic() knows
  • img draw an image, from its path or its bytes, width characters wide (the terminal’s width without one, or 80)
  • lsb the low bits of an image’s pixels as bytes, the usual way to hide a message in a picture
  • bit_plane one bit of one color channel of an image as a black and white PNG, white where the bit is set

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.