bytes
raw bytes, as read from a file or built by hand
1# bytes2b"\x7fELF\n"3# b then quotes4b"\x7fELF"5# from text6"hi".bytesb"hi"Example outputCtrl+Enter to run
syntax
Section titled “syntax”1# b[i] is a byte's value2b"hi"[0]104Example outputCtrl+Enter to run
Functions that take it
Section titled “Functions that take it”wccount lines, words and bytes, like the Unix wc toolhamminghow many positions two equal-length strings differ at, the Hamming distanceencodeencode bytes, or a string’s UTF-8 bytes, in the named formatdecode_autotry 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 firstflag_findfind 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 deepbytesa string’s UTF-8 bytes, bytes made from a list of integers 0-255, or an integer’s bytesintbytes read as one unsigned integer of any length, big-endian (most significant first) unless “little”pkcs7_padbytes padded to a multiple of size, 16 by default, with PKCS#7: n copies of the byte n, from 1 to sizepkcs7_unpadbytes with their PKCS#7 padding removed, checking it’s valid for blocks of size, 16 by defaultfrom_bytesa string from UTF-8 bytes, given as bytes or as a list of integersbyte_lenhow many bytes the text takes in UTF-8, rather than how many characters it hashexdumpbytes shown as a hex dump, like the xxd tool, or just n bytes around address atdiffwhat changed from bytes a to b, by hex dump row, or nil if nothing didbindiffwhat changed from bytes a to b as a table of offset, size, old and new, a row per run of changed bytesfindthe offset of the first match of needle in bytes, or nilfind_allthe offset of every match of needle in bytes, overlapping ones toopatcha copy of bytes with new written over them at offsetstringsthe readable text hidden in binary data: every run of at least min printable characters, like the Unix toolentropyhow unpredictable the bytes are (Shannon entropy)crc32the CRC-32 checksum, as an integer, the same one zip files and PNG images usexor_solvefind the repeating key that bytes were XORed with, assuming the plain text is English, and return {key, text}freqhow often each symbol appears in s, as a table of symbol, count and percent, the most common firstngramsevery run of n symbols in s with how often it appears, as a table of gram and count, the most common firstiocthe index of coincidence of s: the chance that two symbols picked from it at random are the samechi_squaredhow far the letters of s are from English letter frequencies, as a chi-squared value, where lower is closerfriedmanthe length of a repeating key, estimated from the index of coincidence by Friedman’s formulakey_lengthseach 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 firstkasiskithe Kasiski examination of s: runs of n symbols that appear more than once, and the key lengths their distances point to, as {repeats, factors}analyzea quick look at the statistics of s, as a map of length, symbols, entropy, ioc, chi_squared, top and likelyaes_encryptencrypt with AES, the standard block cipher, in mode “ecb”, “cbc”, “ctr” or “gcm”aes_decryptdecrypt AES, the reverse of aes_encrypt with the same key, mode and IVdes_encryptencrypt with DES, or Triple DES given a 16- or 24-byte key, in mode “ecb”, “cbc” or “ctr”des_decryptdecrypt DES or Triple DES, the reverse of des_encryptchacha20encrypt or decrypt with ChaCha20 (RFC 8439), a 32-byte key and a 12-byte nonce, as the same call does bothrc4encrypt or decrypt with RC4, as the same call does bothlenhow many items a list, map or set has, characters a string has, or bytes a bytes value hasrsa_encrypttextbook RSA encryption, m ** e mod n, with no paddinghexan integer in hex, the same asv to hexu81 byte back to an integer from 0 to 255u162 bytes back to a non-negative integer, lowest byte first, or highest first if order is “big”u324 bytes back to a non-negative integer, lowest byte first, or highest first if order is “big”u648 bytes back to a non-negative integer, lowest byte first, or highest first if order is “big”xorxor 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 bisa ^ bAn int key is a single byte. Xor-ing again with the same key gives back the originalcyclic_findhow many bytes into the cyclic pattern sub appears, or nilbinaryread 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 withdisasmdisassemble x86 or x64 machine code into assembly, laid out likeobjdump -d, or with table into a table of addr, bytes and textgadgetsfind ROP gadgets: short runs of instructions ending inret, the pieces a return-oriented exploit chains together when it can’t run code of its ownxrefsfind the instructions in a binary that call, jump to or read from an address or symbolmagicwhat kind of file this is, from the signature bytes it starts with, like thefilecommanddecompressuncompress bytes in any format this module knows (gzip, zlib, xz, zstd, bzip2, or raw deflate), picked by its signatureinflateuncompress raw deflate data, the format inside zip files, gzip and PNG imagesdeflatecompress bytes with raw deflate, no header or checksumgunzipuncompress gzip data, the.gzformat, checking its CRC-32gzipcompress bytes into gzip, the.gzformatunzlibuncompress zlib data, deflate with a 2-byte header and an Adler-32 checksum, as in PDFs and PNG chunkszlibcompress bytes into zlib, deflate with a 2-byte header and an Adler-32 checksumunxzuncompress xz data, the.xzformatxzcompress bytes into xz, the.xzformatunzstduncompress Zstandard data, the.zstformatzstdcompress bytes into Zstandard, the.zstformat, at its fastest levelbunzip2uncompress bzip2 data, the.bz2formatbzip2compress bytes into bzip2, the.bz2formatpng_chunksthe chunks of a PNG file as a table of offset, type, length, data, crc and crc_okexifthe EXIF metadata of a JPEG, PNG or TIFF file as a map, like the camera, the time a photo was taken and wherepcapthe 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 payloadphp_unserializeread PHP’s serialize() format into zil valuespickle_dislist the opcodes of a Python pickle, like pickletools.dis, as a table of offset, op and argentropy_mapthe entropy of each block of bytes, 256 by default, to spot compressed or encrypted regions in a fileunzipthe files in a zip archive as a table of name, size, data, crc, encrypted and commentzip_infothe files listed in a zip archive, without unpacking them: name, size, packed, method, crc, encrypted and commentuntarthe files in a tar archive as a table of name, size and dataun7zthe files in a 7z archive as a table of name, size, data and crcinfo_7zthe files listed in a 7z archive, without unpacking them: name, size and crccarvefind the files embedded in bytes, like binwalk, by searching for every signature magic() knowsimgdraw an image, from its path or its bytes, width characters wide (the terminal’s width without one, or 80)lsbthe low bits of an image’s pixels as bytes, the usual way to hide a message in a picturebit_planeone 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.