附件图片为Tanner图
可还原校验矩阵
c0 | c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 | |
---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | f0 |
1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | f1 |
0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | f2 |
0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | f3 |
0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | f4 |
根据校验矩阵,可以用脚本还原码字
'''
Author: Jack Jparrow
Date: 2022-02-27 12:01:40
LastEditTime: 2022-02-27 12:25:23
LastEditors: Jack Jparrow
Description: 根据校验矩阵求码字
'''
import numpy as np
N = 10
K = 5
b = []
H = np.array([[ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
[ 1, 0, 0, 0, 1, 1, 1, 0, 0, 0],
[ 0, 1, 0, 0, 1, 0, 0, 1, 1, 0],
[ 0, 0, 1, 0, 0, 1, 0, 1, 0, 1],
[ 0, 0, 0, 1, 0, 0, 1, 0, 1, 1]])
for i in range(2**N):
a = format(i, 'b')
b.append("{:0>10s}".format(a))
v = np.zeros((2**N, N))
for i in range(2**N):
v[i] = b[i]
for j in range(N):
v[i][j] = b[i][j] # v是0000000~1111111
w = np.zeros((1, N - K))
for o in range(2**N):
if np.all(np.dot(v[o], H.T) % 2 == w):
print(v[o])
结果共有64行
010editor打开图片,在图片最后发现hint:
对码字稍加处理,只按行留下二进制数值,进行二进制累加求和
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
/**
* @Author: Jack Jparrow
* @Date: 2022-02-27 14:14:12
* @LastEditTime: 2022-03-04 14:55:39
* @LastEditors: Jack Jparrow
* @Description: 读文件,求和
*/
public class Tanner {
public static void main(String[] args) {
int sum=0;// 和
File myFile = new File("D:\\Desktop\\res.txt");
try {
InputStreamReader Reader = new InputStreamReader(new FileInputStream(myFile), "UTF-8");
BufferedReader bufferedReader = new BufferedReader(Reader);
String lineTxt = null;
while ((lineTxt = bufferedReader.readLine()) != null) {
sum += Integer.parseInt(lineTxt, 2);// 求和
Reader.close();
}
System.out.println(Integer.toBinaryString(sum));// 输出结果的二进制形式
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
将结果进行sha256加密,加上SUSCTF{}即为flag