|
1 |
| -# BinaryStringRW |
2 |
| -####read out binary as string and write binary (string) in files to reduct. |
3 |
| -####本算法用来测试将二进制以字符串的形式读出与将字符串(二进制形式)写入原文件,保持数据不变 |
4 |
| ------------------------------- |
5 |
| -####this algorithm is used to read file's binary out as string then write those binary(string) into a new file to reduct the raw file |
6 |
| -by Kanch @2015-10-4 |
7 |
| -http://akakanch.com |
8 |
| - |
9 |
| -core algorithm included in BinaryStringRWAlgorithm files :) |
10 |
| -. |
11 |
| ------------------------------------------- |
12 |
| -######NOTICE |
13 |
| -######You may need set up files below to make this main function works |
14 |
| -const char* testfilepath = "C:\\binalgtest\\rawfile.txt"; //the raw file path(file you used to read out binary) |
15 |
| -const char* binarydatapath = "C:\\binalgtest\\binstring.txt"; //binary string path(file used to save binary-string) |
16 |
| -const char* targetfilepath = "C:\\binalgtest\\reductionfile.txt"; //reduction file via a known binary string |
17 |
| -. |
18 |
| ------------------------------------------------ |
19 |
| -you may need doc below to understand some points of this algorithm |
20 |
| -https://docs.google.com/drawings/d/1odXlKXx6MggQvDeObna4wYsEd_kVF23HoaM_Si7z32M/edit?usp=sharing |
21 |
| -. |
22 |
| ---------------------------------------- |
23 |
| -any way,hope this algorithm can help you. |
24 |
| -I mean,when you read a file's binary out,you know,you can analyize it,then,you know what can you do with it. |
25 |
| -but there are still some problems,like portable,or the effectiveness. |
26 |
| -so I hope you guys can help me to fix it,make it much better. :) |
| 1 | +# BinRW |
| 2 | + |
| 3 | +该算法用于读取文件二进制数据。或者从已有二进制数据恢复文件。 |
| 4 | + |
| 5 | +by Kanch -> kanchisme at gmail . com |
| 6 | + |
| 7 | +# 算法示例 |
| 8 | + |
| 9 | +假设有一个文件,内容如下: |
| 10 | +``` |
| 11 | +this is a test by Kanch. |
| 12 | +``` |
| 13 | + |
| 14 | +在经过本程序处理后,得到其二进制代码如下: |
| 15 | +``` |
| 16 | +001011100001011010010110110011100000010010010110110011100000010010000110000001000010111010100110110011100010111000000100010001101001111000000100110100101000011001110110110001100001011001110100 |
| 17 | +``` |
| 18 | +同理,可以由以上二进制代码恢复源文件。 |
| 19 | + |
| 20 | +# 使用方法 |
| 21 | + |
| 22 | +#### 调用命令: |
| 23 | + |
| 24 | +> brw [input-file] [output-file] [mode: -a(all),-r(range)] [l-range] [r-range] |
| 25 | +
|
| 26 | +#### 参数解释: |
| 27 | + |
| 28 | +`input-file`: 需要处理的源文件路径 |
| 29 | + |
| 30 | +`output-file`:输出的目标文件路径,如果该项为“-”则在命令行输出结果 |
| 31 | + |
| 32 | +`mode`:处理模式,`-a` 全部读取,`-r` 按照区间读取,`-rdt` 从二进制恢复文件 |
| 33 | + |
| 34 | +`l-range`:如果模式为 -r,则这里输入读取起始位置(单位bit) |
| 35 | + |
| 36 | +`r-range`:如果模式为 -r,则这里输入读取结束位置(单位bit,带范围检查) |
| 37 | + |
| 38 | +**注意:如果在-r模式先仅给出一个值(l-range或者r-range),程序将会从文件起始位置读取到给定值位置。 |
| 39 | + |
| 40 | +# 其它 |
| 41 | + |
| 42 | +您可以在GPL协议下自由修改本代码。 |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
0 commit comments