-
-
[原创][推荐][原创] 2021 KCTF 秋季赛 防守方提交题目
-
发表于:
2021-10-7 11:36
7893
-
[原创][推荐][原创] 2021 KCTF 秋季赛 防守方提交题目
de23f9d82798377ea01743d43d5353cd
def
pure_block_cipher_encrypt(p:
list
, k:
list
, round_n:
int
, constant_c:
list
):
assert
len
(p)
=
=
2
assert
len
(k)
=
=
2
pl
=
p[
0
]
pr
=
p[
1
]
tmpl
=
pl
tmpr
=
pr
for
i
in
range
(round_n):
tmpl, tmpr
=
pure_block_cipher_enc_round(tmpl, tmpr, k[i
%
2
], constant_c[i])
return
tmpl, tmpr
def
pure_block_cipher_enc_round(xl, xr, ki, ci):
yl
=
xr
yr
=
xl
+
(xr
+
ki
+
ci)^
3
return
(yl, yr)
def
pure_block_cipher_encrypt(p:
list
, k:
list
, round_n:
int
, constant_c:
list
):
assert
len
(p)
=
=
2
assert
len
(k)
=
=
2
pl
=
p[
0
]
pr
=
p[
1
]
tmpl
=
pl
tmpr
=
pr
for
i
in
range
(round_n):
tmpl, tmpr
=
pure_block_cipher_enc_round(tmpl, tmpr, k[i
%
2
], constant_c[i])
return
tmpl, tmpr
def
pure_block_cipher_enc_round(xl, xr, ki, ci):
yl
=
xr
yr
=
xl
+
(xr
+
ki
+
ci)^
3
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
最后于 2021-12-15 13:05
被kanxue编辑
,原因: