-
-
[原创][推荐][原创] 2021 KCTF 秋季赛 防守方提交题目
-
发表于:
2021-10-7 11:36
7877
-
[原创][推荐][原创] 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
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
最后于 2021-12-15 13:05
被kanxue编辑
,原因: