给的题目:
My friend Shamir was trying to share the flag with me and some of the other problem writers, but he wanted to make sure it didn’t get intercepted in transmission, so he split it up. He said that the secrets that he shared will help us find the flag, but I can’t figure it out! These are the secrets I’ve gathered so far:
(C81E728D9D4C2F636F067F89CC14862C, 31E96A93BF1A7CE1872A3CCDA6E07F86)
(ECCBC87E4B5CE2FE28308FD9F2A7BAF3, ADF6E4F1052BDE978344743CCDCF5771)
(E4DA3B7FBBCE2345D7772B0674A318D5, 0668FBCFE4098FEA0218163AC21E6531)
Can you figure out which flag is the right one?
by balex
writeup
题目的考点是关于 Shamir’s 秘密分享
wiki:Shamir’s Secret Sharing
对应算法示例:
题目中的三组16进制值,不是16进制数,而是哈希值,MD5。
md5解密得到:
(2,5398141)
(3,5398288)
(5,5398756)
所以用sage在有限域上解密 exp.sage
x_0,y_0 = (2,5398141)
x_1,y_1 = (3,5398288)
x_2,y_2 = (5,5398756)
R.<x> = QQ[]
l_0 = ((x-x_1)/(x_0-x_1))*((x-x_2)/(x_0-x_2))
l_1 = ((x-x_0)/(x_1-x_0))*((x-x_2)/(x_1-x_2))
l_2 = ((x-x_0)/(x_2-x_0))*((x-x_1)/(x_2-x_1))
f_x = (y_0*l_0) + (y_1*l_1) + (y_2*l_2)
print(f_x)
[out]:
29*x^2 + 2*x + 5398021
将5398021作为flag,发现错误。5398021只能是对于txt文件中的行数,对应flag:utflag{wOq0}
从BUUCTF上下载的文件中没有这个 txt 附件,去github找一下。