[UTCTF2020]Cube Crypto
题目
Mr. Anshel and Mr. Goldfeld were trying to exchange some asymmetric keys to get a shared key. They aren’t very good at math, so they decided to use a Rubik’s Cube instead to do the crypto. I don’t think it’s very secure though, I think you might be able to guess some of their keys :hmm:
Mr. A public key: [B' U', F B F, R' D, B D']
Mr. G public key: [R D L', D U' B, U F', L' F]
Mr. A sends: [B D' R' D R D L' D' R D B', B D' R' D D U' B D' R D B', B D' R' D U F' D' R D B', B D' R' D L' F D' R D B']
Mr. G sends: [U F' R D L' B' U' L D' R' F U', U F' R D L' F B F L D' R' F U', U F' R D L' R' D L D' R' F U', U F' R D L' B D' L D' R' F U']
NOTE: The flag is the shared key that they generate, so it is NOT in utflag{}
format
by balex
解题
Anshel先生和Goldfeld先生试图交换一些非对称密钥以获得共享密钥。他们的数学不是很好,所以他们决定用魔方来做加密。不过我觉得这不是很安全,我想你可能能猜到他们的一些钥匙:嗯:
A先生公钥:[B'U',F,R'D,B'D']
G先生公钥:[R D L',D U'B,U F',L'F]
A先生发送:[B D'R'D R D L'D D B',B D'R'D U'B D'R D B',B D'R'D U F'D'R D B',B D'R'D L'F D'R D B']
G先生发送:[U F'R D L'B'U'L D'R'F U',U F'R D L'F F D'R'F U',U F'R D L'R'D L'R'F U',U F'R'D L'B D'R'F U']
注意:该标志是它们生成的共享密钥,因此它不是“utflag{}”格式
巴莱克斯
用魔方加密先了解魔方公式
这样至少知道他们再干什么了
根据密钥交换协议
由上图可知,Alice的公钥是a组成的元组,私钥是a和它的逆组成的序列
Bob的公钥是b组成的元组,,私钥是b和它的逆组成的序列
他们的共享密钥e=A-1 B-1 A B
由于协议基于非阿贝尔群,所以不满足交换
通过Alice与Bob发出的信息,我们可以很容易的看出A-1 、A、 B-1、 B
flag即为共同密钥e
(a1, a2, a3)=[B’ U’, F B F, R’ D, B D’]
(B-1 a1 B,B-1 a2 B,B-1 a3 B,B-1 a4 B)=[U F’ R D L’ B’ U’ L D’ R’ F U’, U F’ R D L’ F B F L D’ R’ F U’, U F’ R D L’ R’ D L D’ R’ F U’, U F’ R D L’ B D’ L D’ R’ F U’]
联立得:
B-1 = U F’ R D L’
B=L D’ R’ F U’
同理求得
A-1=BD’R’D
A=D’RDB’
则,公共密钥e=B D’ R’ D U F’ R D L’ D’ R D B’ L D’ R’ F U’
答案
flag{B D’ R’ D U F’ R D L’ D’ R D B’ L D’ R’ F U’}