Skip to content

Commit aad710b

Browse files
committed
First and rough kina working version
1 parent db8c523 commit aad710b

6 files changed

+466
-1
lines changed

README.md

+53-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,54 @@
11
# bsdiff
2-
A tool to diff bitstream files
2+
An experimental tool to diff bitstream files
3+
4+
I'm trying to reverse engineer some proprietary binary files, and I
5+
noticed that these files are bit streams (as opposed to byte stream).
6+
7+
My approach is to compare two files that have minimal diferrence and
8+
see how the bitstream behave, I need to be able to detect bit flips as
9+
well as bit insertion/deletion between two files.
10+
11+
This is a very beta version of such a tool, it attempts to mimic the
12+
unix "diff" tool, but display bits instead of text.
13+
14+
For now, the algorithm is very stupid and simple, it doesn't yet
15+
understand the concept of context as used in GNU diff and patch.
16+
17+
I might improve this tool to fit my needs.
18+
19+
# Example output
20+
21+
In the example below, you can see that at position 0, the first file
22+
contains "1100" where as the second file contains "0010".
23+
24+
Then the files are identical up to the 144975'th bit. At this bit
25+
position, the first file contains "110" whereas the second one
26+
contains "01100", that is the second file as 2 more bits that the
27+
first one.
28+
29+
The two files have then roughly 10k identical bits, after which there
30+
a new difference "110" vs "011010110", ...
31+
32+
As you might have noticed, this tool is able to track bit assertion
33+
and removal.
34+
35+
$ bsdiff Si8605AC-B-IS1.bxl Si8606AC-B-IS1.bxl
36+
--- Si8605AC-B-IS1.bxl
37+
+++ Si8606AC-B-IS1.bxl
38+
@@ [4,0] -4,-4 +4,4 @@
39+
-1100
40+
+0010
41+
^^^
42+
@@ [3,2] -144975,-3 +144975,5 @@
43+
- 110
44+
+01100
45+
^^ ^
46+
@@ [3,6] -152419,-3 +152421,9 @@
47+
- 110
48+
+011010110
49+
^^^^^^
50+
@@ [2,0] -154292,-2 +154300,2 @@
51+
-11
52+
+01
53+
^
54+
...

bindiff.pro

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#-------------------------------------------------
2+
#
3+
# Project created by QtCreator 2015-07-09T10:58:01
4+
#
5+
#-------------------------------------------------
6+
7+
QT += core gui
8+
9+
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10+
11+
TARGET = bindiff
12+
TEMPLATE = app
13+
14+
15+
SOURCES += main.cpp\
16+
mainwindow.cpp
17+
18+
HEADERS += mainwindow.h
19+
20+
FORMS += mainwindow.ui

0 commit comments

Comments
 (0)