Summary of Lecture 4
Security of RSA: Without , it’s difficult to learn from
- “Factoring is easy” “Plain RSA is not secure”
- “Plain RSA is secure” “Factoring is hard”
- “Factoring is hard” “Plain RSA is secure”? //not proved, likely true
Commitment Scheme:
- hiding:
- binding: and ? Impossible
CONSTRUCTION: based on RSA
- Com:
- Ver:
RSA Implementation:
- choose efficiently? compute efficiently? compute / efficiently?
Addition
Binary Representation of an integer : a 0-1 sequence / binary string such that
Bit Length of Integer :
Algorithm for Addition:
- Input: //
- Output: //
- for to do
- //
- set and such that //
- Complexity: bit operations
Big O notation:
Subtraction
Algorithm for Subtraction:
- Input: //
- Output: //
- for to do
- //
- set and such that //
- Complexity: bit operations
Multiplication
Algorithm for Multiplication:
- Input: //
- Output: //
- for to do
- if , then ;
- ;
- Complexity: bit operations
Division
Algorithm for Division:
- Input: //
- Output: and //
- for down to do
- //
- If , then // and
- while do
- output and
- Complexity: bit operations
Example:
Arithmetic Modulo
THEOREM: Let . Then
- can be computed in bit operations
- are computable in bit operations
- : computable in bit operations
- can be computed in bit operations
- is computable in bit operations
- : computable in bit operations.
Modulo exponentiation: For
- Complexity? How to compute efficiently?
EXAMPLE: modulo exponentiation
- 143733911392049898163790620742447116344546040644898141520376037626365007809899615665793895112104794373551079787727363529151277801402630305742433442340983358787394193855033926469913603762712163723160462115649025
- 46310011625494823943446873944318243690297367227688331207962573871391818800156614404181253994785434292576255362553884181998492463297303466464428022018327564723810228367576715525319623371983456905064392494176785
- 245246644900278211976517663573088018467026787678332759743414451715061600830038587216952208399332071549103626827191679864079776723243005600592035631246561218465817904100131859299619933817012149335034875870551067
- 245246644900278211976517663573088018467026787678332759743414451715061600830038587216952208399332071549102628322861627039184220494270313938703906283392288487724394251766892786817697178343799758481228648091667216
- Complexity: multiplications modulo
- ?
–very slow
Square-and-Multiply
ALGORITHM: (200 BC) compute in polynomial time
- Input:; //
- Output:
- Square: this step requires multiplications modulo
- Multiply: this step requires multiplications modulo
- Complexity: multiplications modulo
–fast
EXAMPLE: Compute using square-and-multiply.
- Input:
- Square: multiplications modulo will be done
- Multiply: at most multiplications modulo will be done
Time-Lock Puzzle
Question: The fastest method of computing ? Square-and-multiply?
MIT LCS35 Time Capsule Crypto Puzzle:
- LCS 35th Celebration (April 12-13, 1999)
- By Ronald L. Rivest, Adi Shamir, and David A. Wagner
- Intrinsically Sequential Computations: Can’t be sped up using parallelism
- Creating the Puzzle:
- Create as the product of two primes
- Choose as the number of operations required
- Publish as the puzzle description
- Puzzle: compute
- Method: square-and-multiply (repeated squaring)
- Solution is
New puzzle: 2019-05-14 Expected to be solved in 2034
Modern applications: blockchain (green consensus)
Encrypting to the future
Question: Encrypt a message such that it can be decrypted (w/o key) in 35 years?
Encrypting a message to the future with TLP:
- Create a TLP with the aforementioned scheme. Record the primes .
- Compute quickly with the primes
- // is much smaller that
- Compute very quickly
- // Rivest, Shamir, Wagner, 1996
Analysis:
- With , it is very quick to compute and decrypt to
- With , it may take 35 years to compute and then learn
- Although Bernard Fabrot solved this with 3.5 years of computation
平方乘那个例子我算出来也是8,你再检查下中间步骤?
老铁,这套时间锁思路我已经收藏好啦👍
如果把t设置成几千,算力真的要等上几十年吗?有没有研究在硬件上做并行加速的方案?
模幂复杂度看着还行
说量子会直接废掉算力差,那也太绝对了
平方乘的思路挺好,实际代码里记得把模数提前取余,省不少乘法
这篇把大数运算写得像拼图,脑子要炸😅
我之前写过RSA实现,调试的debug真是噩梦
这个t选多少合适,实际会不会卡在计算上?
看着时间锁谜题被提前破,感觉戏剧性十足😂
这段平方乘真的爽快
这算法确实爽,但写代码时边界条件坑死人。
大数运算看着头秃,还好有现成库能用
2^t mod φ(n) 这步要是φ(n)泄露就全完了,太依赖因式分解难度了
φ(n)一泄露整个时间锁就崩了,太脆了。
反复平方确实快,但内存占用是不是也得考虑下?
内存问题确实存在,大数运算时缓存管理很关键
那个commitment scheme用RSA构造的,binding性真的牢吗?
所以加密到未来就是靠算力差?现在量子计算机一出不就废了
除法那块的while循环会不会死循环啊?感觉没说清楚
以前密码学课上老师讲这个,全班就俩人听懂了😂
模幂运算复杂度O(k)看着简单,写代码时边界条件坑死人
除法算法那个while循环,我之前写的时候死循环了好几次,心态崩了
这时间锁谜题居然3.5年就破了,硬件进步太快了吧
平方乘算法那个例子算出来是8?我手算咋不对🤔
所以那个时间锁谜题最后是被提前解开了?还以为真要等到 2034 年呢 😂
以前搞密码学作业就在这步卡壳,反复平方再乘确实比硬算快太多。
平方乘那段看得我直呼过瘾,比硬算快太多了!
模幂运算这块挺绕的。
同感,需要多练几遍。
RSA那部分看得有点懵,再琢磨琢磨。
同感,那部分确实有点绕
时间锁那个例子,真有人算三年多啊?
这毅力也是没谁了
这算法名字挺酷的,平方乘。
时间锁这概念有点意思,感觉像现实版时光胶囊。
同感,未来感很强。
平方乘算法例子算得挺清楚的
模运算这块,二进制表示看着就头大。
RSA这玩意儿,学一次忘一次😂
反复平方法原来这么早就有了啊
算法历史挺有意思的
量子计算机真来了,时间锁是不是直接变废铁?
commitment scheme那块构造逻辑有点绕,回头再啃。
t设太大怕等几十年,设太小又秒破,难搞。
模幂运算看着简单,实际debug到凌晨😭
我之前调库都调吐了,自己实现根本不敢想。
binding性全靠大数分解撑着,有点悬。
现在谁还敢用plain RSA,不加padding等于裸奔。
除法算法里的while循环感觉容易出bug啊。
那个LCS35谜题真有人跑3年多?佩服耐心😂
反复平方快是快,但缓存小的设备估计扛不住。
手算验证了下例子,确实是8,中间步骤没错。
现在还有人真用plain RSA?不加padding太危险了
反复平方快是快,但缓存不够的设备怕是要卡死
看着2^t mod φ(n)就头皮发麻,不敢想写错一步
除法算法里那个while循环边界容易崩吧
这commitment scheme要是p q泄露就全完了啊
平方乘算法还挺巧妙的。
确实,很巧妙的设计
这模幂运算的复杂度推导看得我头大,有没有人画个流程图?