[UTCTF2020]Curveball (考点:Shamir‘s 秘密分享)

给的题目:

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找一下。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值