脚本下载
bool
__attribute((__annotate__((
"virtualization"
)))) function2(uint8_t
*
key,uint8_t
*
text)
{
for
(
int
i
=
0
;i<
16
;i
+
+
)
key[i]
=
R8(key[i]^(i
+
3
),i
%
8
);
uint32_t a
=
*
((uint32_t
*
)&key[
0
]),b
=
*
((uint32_t
*
)&key[
4
]),c
=
*
((uint32_t
*
)&key[
8
]),d
=
*
((uint32_t
*
)&key[
12
]);
uint32_t key_stream[
16
],tmp[
16
];
for
(
int
i
=
0
;i<
4
;i
+
+
)
{
a
=
((b
*
c)&
0xdeadbfef
)
+
(a<<
3
)
+
(d>>
29
);
b
=
((c
*
d)&
0xdefdbeef
)
+
(b<<
7
)
+
(a>>
25
);
c
=
((d
*
a)&
0xdfadbeef
)
+
(c<<
9
)
+
(b>>
23
);
d
=
((a
*
b)&
0xdeadbeff
)
+
(d<<
1
)
+
(c>>
31
);
key_stream[
4
*
i]
=
d
+
0xdeadbeef
;
key_stream[
4
*
i
+
1
]
=
c
+
0xaa114514
;
key_stream[
4
*
i
+
2
]
=
a
+
0xf1919810
;
key_stream[
4
*
i
+
3
]
=
b
+
0x1abcdef1
;
/
/
printf(
" key stream : %x %x %x %x\n"
,key_stream[
4
*
i],key_stream[
4
*
i
+
1
],key_stream[
4
*
i
+
2
],key_stream[
4
*
i
+
3
]);
}
for
(
int
i
=
0
;i<
32
;i
+
+
)
{
uint8_t c
=
text[i];
c
=
((c&
0xaa
)>>
1
)|((c&
0x55
)<<
1
);
c
=
((c&
0xcc
)>>
2
)|((c&
0x33
)<<
2
);
c
=
((c&
0xf0
)>>
4
)|((c&
0x0f
)<<
4
);
text[i]
=
c;
for
(
int
j
=
0
;j<
32
;j
+
+
)
text[j]^
=
R32(key_stream[j
%
16
],j)&
0xff
;
function1(tmp,key_stream);
for
(
int
j
=
0
;j<
16
;j
+
+
)
key_stream[j]
=
tmp[j];
}
for
(
int
x
=
0
;x<
4
;x
+
+
)
{
uint8_t t
=
text[
8
*
x];
for
(
int
y
=
0
;y<
100
;y
+
+
)
{
for
(
int
i
=
0
;i<
8
;i
+
+
)
{
t
=
t
+
(key[
2
*
i]^key[
2
*
i
+
1
]);
t
=
Sbox[t]
+
text[
8
*
x
+
(i
+
1
)
%
8
];
t
=
(t<<
1
) | (t>>
7
);
text[
8
*
x
+
(i
+
1
)
%
8
]
=
t;
}
}
}
uint32_t
*
ptr
=
(uint32_t
*
)text;
for
(
int
i
=
0
;i<
8
;i
+
+
)
{
uint64_t v
=
0
;
for
(
int
j
=
0
;j<
32
;j
+
+
)
{
int
b
=
(ptr[i]>>j)&
1
;
v
+
=
weights[j]
*
b;
v
%
=
mod;
}
if
(v!
=
sums[i])
return
false;
}
return
true;
}
bool
__attribute((__annotate__((
"virtualization"
)))) function2(uint8_t
*
key,uint8_t
*
text)
{
for
(
int
i
=
0
;i<
16
;i
+
+
)
key[i]
=
R8(key[i]^(i
+
3
),i
%
8
);
uint32_t a
=
*
((uint32_t
*
)&key[
0
]),b
=
*
((uint32_t
*
)&key[
4
]),c
=
*
((uint32_t
*
)&key[
8
]),d
=
*
((uint32_t
*
)&key[
12
]);
uint32_t key_stream[
16
],tmp[
16
];
for
(
int
i
=
0
;i<
4
;i
+
+
)
{
a
=
((b
*
c)&
0xdeadbfef
)
+
(a<<
3
)
+
(d>>
29
);
b
=
((c
*
d)&
0xdefdbeef
)
+
(b<<
7
)
+
(a>>
25
);
c
=
((d
*
a)&
0xdfadbeef
)
+
(c<<
9
)
+
(b>>
23
);
d
=
((a
*
b)&
0xdeadbeff
)
+
(d<<
1
)
+
(c>>
31
);
key_stream[
4
*
i]
=
d
+
0xdeadbeef
;
key_stream[
4
*
i
+
1
]
=
c
+
0xaa114514
;
key_stream[
4
*
i
+
2
]
=
a
+
0xf1919810
;
key_stream[
4
*
i
+
3
]
=
b
+
0x1abcdef1
;
/
/
printf(
" key stream : %x %x %x %x\n"
,key_stream[
4
*
i],key_stream[
4
*
i
+
1
],key_stream[
4
*
i
+
2
],key_stream[
4
*
i
+
3
]);
}
for
(
int
i
=
0
;i<
32
;i
+
+
)
{
uint8_t c
=
text[i];
c
=
((c&
0xaa
)>>
1
)|((c&
0x55
)<<
1
);
c
=
((c&
0xcc
)>>
2
)|((c&
0x33
)<<
2
);
c
=
((c&
0xf0
)>>
4
)|((c&
0x0f
)<<
4
);
text[i]
=
c;
for
(
int
j
=
0
;j<
32
;j
+
+
)
text[j]^
=
R32(key_stream[j
%
16
],j)&
0xff
;
function1(tmp,key_stream);
for
(
int
j
=
0
;j<
16
;j
+
+
)
key_stream[j]
=
tmp[j];
}
for
(
int
x
=
0
;x<
4
;x
+
+
)
{
uint8_t t
=
text[
8
*
x];
for
(
int
y
=
0
;y<
100
;y
+
+
)
{
for
(
int
i
=
0
;i<
8
;i
+
+
)
{
t
=
t
+
(key[
2
*
i]^key[
2
*
i
+
1
]);
t
=
Sbox[t]
+
text[
8
*
x
+
(i
+
1
)
%
8
];
t
=
(t<<
1
) | (t>>
7
);
text[
8
*
x
+
(i
+
1
)
%
8
]
=
t;
}
}
}
uint32_t
*
ptr
=
(uint32_t
*
)text;
for
(
int
i
=
0
;i<
8
;i
+
+
)
{
uint64_t v
=
0
;
for
(
int
j
=
0
;j<
32
;j
+
+
)
{
int
b
=
(ptr[i]>>j)&
1
;
v
+
=
weights[j]
*
b;
v
%
=
mod;
}
if
(v!
=
sums[i])
return
false;
}
return
true;
}
old:
a
=
b
+
c
...
y
=
x
*
a
-
>
new:
a
=
b
+
c
...
y
=
x
*
(b
+
c)
old:
a
=
b
+
c
...
y
=
x
*
a
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
最后于 2022-5-6 17:50
被R1mao编辑
,原因: 添加题目elf文件