-
Notifications
You must be signed in to change notification settings - Fork 1
/
SAMPLE
115 lines (102 loc) · 6 KB
/
SAMPLE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Sample output from bitpacker.
First block is bytes to pack showing bits
Second block is packed bytes.
Third block is unpacked bytes from block 2.
You can easily see the bit shifting by following diagonals
from top right to bottom left. Using the same character
for testing makes packing easier to see.
First column is printable character byte to pack
Second column is the ASCII code
Third+ columns are bits 7 to 0
The middle group are the packed bytes.
The right group are the unpacked bytes.
$ ./bptest 111111111
Input length is: 9
Output length is: 8
Unpack length is: 9
Char: 7 6 5 4 3 2 1 0 Char: 7 6 5 4 3 2 1 0 Char: 7 6 5 4 3 2 1 0
--------------------- --------------------- ---------------------
1 31: 0 0 1 1 0 0 0 1 b 62: 0 1 1 0 0 0 1 0 1 31: 0 0 1 1 0 0 0 1
1 31: 0 0 1 1 0 0 0 1 C5: 1 1 0 0 0 1 0 1 1 31: 0 0 1 1 0 0 0 1
1 31: 0 0 1 1 0 0 0 1 8B: 1 0 0 0 1 0 1 1 1 31: 0 0 1 1 0 0 0 1
1 31: 0 0 1 1 0 0 0 1 16: 0 0 0 1 0 1 1 0 1 31: 0 0 1 1 0 0 0 1
1 31: 0 0 1 1 0 0 0 1 , 2C: 0 0 1 0 1 1 0 0 1 31: 0 0 1 1 0 0 0 1
1 31: 0 0 1 1 0 0 0 1 X 58: 0 1 0 1 1 0 0 0 1 31: 0 0 1 1 0 0 0 1
1 31: 0 0 1 1 0 0 0 1 B1: 1 0 1 1 0 0 0 1 1 31: 0 0 1 1 0 0 0 1
1 31: 0 0 1 1 0 0 0 1 b 62: 0 1 1 0 0 0 1 0 1 31: 0 0 1 1 0 0 0 1
1 31: 0 0 1 1 0 0 0 1 - --: - - - - - - - - 1 31: 0 0 1 1 0 0 0 1
base64: YsWLFixYsWI=
base64 encoding successful
$ ./bptest AAAAAAAAA
Input length is: 9
Output length is: 8
Unpack length is: 9
Char: 7 6 5 4 3 2 1 0 Char: 7 6 5 4 3 2 1 0 Char: 7 6 5 4 3 2 1 0
--------------------- --------------------- ---------------------
A 41: 0 1 0 0 0 0 0 1 83: 1 0 0 0 0 0 1 1 A 41: 0 1 0 0 0 0 0 1
A 41: 0 1 0 0 0 0 0 1 06: 0 0 0 0 0 1 1 0 A 41: 0 1 0 0 0 0 0 1
A 41: 0 1 0 0 0 0 0 1 0C: 0 0 0 0 1 1 0 0 A 41: 0 1 0 0 0 0 0 1
A 41: 0 1 0 0 0 0 0 1 18: 0 0 0 1 1 0 0 0 A 41: 0 1 0 0 0 0 0 1
A 41: 0 1 0 0 0 0 0 1 0 30: 0 0 1 1 0 0 0 0 A 41: 0 1 0 0 0 0 0 1
A 41: 0 1 0 0 0 0 0 1 ` 60: 0 1 1 0 0 0 0 0 A 41: 0 1 0 0 0 0 0 1
A 41: 0 1 0 0 0 0 0 1 C1: 1 1 0 0 0 0 0 1 A 41: 0 1 0 0 0 0 0 1
A 41: 0 1 0 0 0 0 0 1 82: 1 0 0 0 0 0 1 0 A 41: 0 1 0 0 0 0 0 1
A 41: 0 1 0 0 0 0 0 1 - --: - - - - - - - - A 41: 0 1 0 0 0 0 0 1
base64: gwYMGDBgwYI=
base64 encoding successful
$ ./bptest "The quick brown fox jumped over the lazy dog!"
Input length is: 45
Output length is: 40
Unpack length is: 45
Char: 7 6 5 4 3 2 1 0 Char: 7 6 5 4 3 2 1 0 Char: 7 6 5 4 3 2 1 0
--------------------- --------------------- ---------------------
T 54: 0 1 0 1 0 1 0 0 A9: 1 0 1 0 1 0 0 1 T 54: 0 1 0 1 0 1 0 0
h 68: 0 1 1 0 1 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 1 y 79: 0 1 1 1 1 0 0 1 e 65: 0 1 1 0 0 1 0 1
20: 0 0 1 0 0 0 0 0 A 41: 0 1 0 0 0 0 0 1 20: 0 0 1 0 0 0 0 0
l 6C: 0 1 1 0 1 1 0 0 93: 1 0 0 1 0 0 1 1 l 6C: 0 1 1 0 1 1 0 0
a 61: 0 1 1 0 0 0 0 1 ~ 7E: 0 1 1 1 1 1 1 0 a 61: 0 1 1 0 0 0 0 1
z 7A: 0 1 1 1 1 0 1 0 t 74: 0 1 1 1 0 1 0 0 z 7A: 0 1 1 1 1 0 1 0
y 79: 0 1 1 1 1 0 0 1 20: 0 0 1 0 0 0 0 0 y 79: 0 1 1 1 1 0 0 1
20: 0 0 1 0 0 0 0 0 - --: - - - - - - - - 20: 0 0 1 0 0 0 0 0
d 64: 0 1 1 0 0 1 0 0 - --: - - - - - - - - d 64: 0 1 1 0 0 1 0 0
o 6F: 0 1 1 0 1 1 1 1 - --: - - - - - - - - o 6F: 0 1 1 0 1 1 1 1
g 67: 0 1 1 0 0 1 1 1 - --: - - - - - - - - g 67: 0 1 1 0 0 1 1 1
! 21: 0 0 1 0 0 0 0 1 - --: - - - - - - - - ! 21: 0 0 1 0 0 0 0 1
base64: qaMqDj1049aDFy399yDNv8INXXbwy5EG/tl5IOmjKg2YfXlBk350IA==
base64 encoding successful
Peter Hyman
Copyright 2022
pete@peterhyman.com