RADIFF2(1)
π radiff2 β Binary Diffing Utility π
okay bestie, sit DOWN. this is radiff2, the binary diffing queen of the radare2 suite, and she is so much. she diffs binary code and data, she does architecture and bits specification, delta diffing, graph-based comparisons β like, the whole menu. π¦
she supports a wide range of formats and features, and that includes architecture and bits specification, delta diffing, graph diffing, and more. no cap.
β¨ SYNOPSIS β¨
radiff2 [-abcCdDehiJjlmnoOprqsStuUvVxXzZ] [-A [A]] [-B addr] [-g sym]
[-m mode] [-o offset] [-l length] [-t %] [-S name] file1 file2
πΈ DESCRIPTION πΈ
a utility for diffing binary code and data, living inside the Radare2 suite. she does architecture and bits specification, delta diffing, and graph-based comparisons. π
and it's not just one lil thing β it supports a wide range of formats and features, including architecture and bits specification, delta diffing, graph diffing, and more. main character energy fr fr.
π OPTIONS π
-a archβ pick which architecture plugin to use (x86,arm, etc.).-A [A]β runaaaoraaaaafter loading each binary (go look at-C).-b bitsβ set the register size for the architecture (16(thumb),32,64, etc.).-B addrβ define the base address that gets added to offsets when listing.-c cmdβ run an r2 command on every singleRCoreinstance that gets created.-Cβ graphdiff code (columns:off-A, match-ratio,off-B) (see-A).-dβ use delta diffing.-Dβ show disasm instead of hexpairs.-e k=vβ set an eval config var value for allRCoreinstances.-f formatβ select the output format (see-f helpfor details).-g symβ graph diff of[sym], or of functions in[off1,off2].-i typeβ compare bin information (imports, exports, symbols, sections, etc.). see-i helpfor details.-jβ output in JSON format.-l lenβ specify the final offset (length) for diffing. can use theA:Bformat to give each file its own length. π―-m modeβ choose the graph output mode (aditsjJ). see-m helpfor details.-nβ count the number of changes.-o offsetβ specify the initial offset for diffing. can use theA:Bformat to give each file its own offset.-Oβ code diffing with opcode bytes only.-pβ use physical addressing (io.va=false) (only forradiff2 -AC).-qβ quiet mode (disables colors, reduces output).-rβ output in radare commands.-sβ compute edit distance (no substitution, Eugene W. MyersO(ND)diff algorithm).-ssβ compute Levenshtein edit distance (substitution is allowed,O(N^2)).-S nameβ sort code diff (name,namelen,addr,size,type,dist) (only for-Cor-g).-t %β set the threshold for code diff (default is70%).-Tβ analyze files in threads (EXPERIMENTAL, 30% faster and crashy). π
bestie be careful: -T is labeled EXPERIMENTAL, it's 30% faster, and it's crashy. the manpage said it, i'm just saying it louder.
-uβ unified output (---+++).-Uβ unified output using the system'diff'.-vβ show version information.-Vβ be verbose (currently only for-s).-xβ show two-column hexdump diffing.-Xβ use xpatch format for the diffing output.
π ENVIRONMENT π
no environment variables are used. that's it, that's the section. she's low maintenance like that. β¨
π GRAPH OUTPUT FORMATS (-m [mode]) π
-aβ ASCII art (default).-sβ r2 commands.-dβ Graphviz dot.-gβ Graph Modelling Language (GML).-jβ JSON.-Jβ JSON with disassembly.-kβ sdb key-value.-tβ Tiny ASCII art.-iβ Interactive ASCII art.
π USAGE EXAMPLES π
comparing two binaries:
$ radiff2 bin1 bin2
using graph diffing to compare functions by name:
$ radiff2 -g main bin1 bin2
counting the number of changes between two binaries:
$ radiff2 -n bin1 bin2
outputting the diff in a unified format:
$ radiff2 -u bin1 bin2
comparing the opcodes of two functions:
$ radiff2 -O bin1 bin2
compare specific sections of binaries with custom offsets:
$ radiff2 -o 0x1000 bin1 bin2
compare different sections with different offsets:
$ radiff2 -o 0x1000:0x2000 bin1 bin2
compare specific lengths from given offsets:
$ radiff2 -o 0x1000 -l 0x500 bin1 bin2
π«Ά RADARE2 COMMANDS π«Ά
the 'c' command in r2 is used for various comparison operations within data inside the same file. here are some examples of its usage:
compare a plain string with escaped chars:
c "string to compare"
compare byte at a specific address with current offset:
c1 0x100
compare block size bytes from current offset and the 0x100 offset:
cc 0x100
unified diff of disassembly from current seek and given address:
cud 0x200 @ 0x100
compare memory hexdumps in unified diff format:
cu 0x100 @ 0x200
for more detailed usage of the 'c' command, refer to the c[?dfx] [argument] help section. iykyk. π₯
β SEE ALSO β
π WWW π
π AUTHOR π
pancake <pancake@nopcode.org>
and that's the whole page, bestie β written by pancake <pancake@nopcode.org> (yes, the legend), and it's part of the radare2 world over at https://www.radare.org/. go diff something cute. mwah. ππβ¨
π¦ where this page comes from
- alpine 3.24: radare2-doc 6.1.6-r0 Β· GPL-3.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later
- arch rolling: radare2 6.2.2-1 Β· GPL-3.0-only AND LGPL-3.0-only
- nixos 26.05: radare2 6.1.8
- opensuse-leap 16.0: radare2 6.2.2-bp160.1.1 Β· GPL-3.0-only AND LGPL-3.0-only
- opensuse-leap 16.0: radare2 6.2.2-bp160.1.1 Β· GPL-3.0-only AND LGPL-3.0-only
- opensuse-leap 16.0: radare2 6.2.2-bp160.1.1 Β· GPL-3.0-only AND LGPL-3.0-only
- opensuse-leap 16.0: radare2 6.2.2-bp160.1.1 Β· GPL-3.0-only AND LGPL-3.0-only
- ubuntu resolute: radare2 6.0.7+ds-1 Β· LGPL-3.0-only
- ubuntu stonking: radare2 6.1.8+ds-1 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms