Key is: b'\xba\x1f\x91\xb2S\xcd>' Plain text is: Cryptography is the practice and study of techniques for, among other things, secure communication in the presence of attackers. Cryptography has been used for hundreds, if not thousands, of years, but traditional cryptosystems were designed and evaluated in a fairly ad hoc manner. For example, the Vigenere encryption scheme was thought to be secure for decades after it was invented, but we now know, and this exercise demonstrates, that it can be broken very easily.
密钥为:Terminator X: Bring the noise、 明文为:Plain textis: I'm back and I'm ringin' the bell A rockin' on the mike while the fly girls yell In ecstasy in the back ofme Well that's my DJ Deshay cuttin' all them Z's Hittin' hard and the girlies goin' crazy Vanilla's on the mike, man I'm not lazy.
I'm lettin' my drug kick in It controls my mouth and I begin To just let it flow, let my concepts go My posse's to the side yellin', Go Vanilla Go!
Smooth 'cause that's the way I will be Andif you don't give a damn, then Why you starin' at me So getoff'cause I control the stage There's no dissin' allowed I'm in my own phase The girlies sa y they love meand that is ok And I can dance better than any kid n' play
Stage 2 -- Yea the one ya' wanna listen to It's off my head so let the beat play through So I can funk it up and make it sound good 1-2-3 Yo -- Knock on some wood For good luck, I like my rhymes atrocious Supercalafragilisticexpialidocious I'm an effect and that you can bet I can take a fly girl and make her wet.
I'm like Samson -- Samson to Delilah There's no denyin', You can try to hang But you'll keep tryin' to get my style Over and over, practice makes perfect But notif you're a loafer.
You'll get nowhere, no place, no time, no girls Soon -- Oh my God, homebody, you probably eat Spaghetti with a spoon! Come onand say it!
VIP. Vanilla Ice yep, yep, I'm comin' hard like a rhino Intoxicating so you stagger like a wino So punks stop trying and girl stop cryin' Vanilla Ice is sellin' and you people are buyin' 'Cause why the freaks are jockin' like Crazy Glue Movin' and groovin' trying to sing along All through the ghetto groovin' this here song Now you're amazed by the VIP posse.
Steppin' so hard like a German Nazi Startled by the bases hittin' ground There's no trippin' on mine, I'm just gettin' down Sparkamatic, I'm hangin' tight like a fanatic You trapped me once and I thought that You might have it So step down and lend me your ear '89 in my time! You, '90 is my year.
You're weakenin' fast, YO! and I can tell it Your body's gettin' hot, so, so I can smell it So don't be mad and don't be sad 'Cause the lyrics belong to ICE, You can call me Dad You're pitchin' a fit, so step back and endure Let the witch doctor, Ice, do the dance to cure So come up close and don't be square You wanna battle me -- Anytime, anywhere
You thought that I was weak, Boy, you're dead wrong So come on, everybody and sing this song
Say -- Play that funky music Say, go white boy, go white boy go play that funky music Go white boy, go white boy, go Lay down and boogie and play that funky music till you die.
Play that funky music Come on, Come on, letme hear Play that funky music white boy you say it, say it Play that funky music A little louder now Play that funky music, white boy Come on, Come on, Come on Play that funky music
求 e 对 \(\phi(n)\) 的逆,即可得到私钥 d,从而解密两条消息。在本题中可以通过公因子攻击解出帧 1 和帧 18 的消息和参数。
破解随机数发生器
从上面的共公因子攻击中,我们找到了由随机数发生器生成的素数 p。假设该随机数发生器采用的随机数产生方式是线性同余,且以 16bit 为单位,则通过对该素数 p 进行参数 a、c 的计算可以破解该随机数发生器的参数,从而采用该随机数发生器以暴力破解的方式获得其它帧的随机数。通过这种方式将暴力破解的随机数空间降低到了 16bit 的可接受范围内。
考虑线性同余随机数发生器 \(x_n+1≡ax_n+c\ (mod\ m)\)。
由于直接对该同余式进行求解,在 m 不确定的情况下存在解不唯一的情况,所以采用分组运算的方式,假设 m 为 \(2^{16}\) 列出方程组并求解 a 和 c。即
上下两式相减,可得:
对于获得的 a 和 c 可以得到随机数发生器的全部参数后通过对随机数发生器 的初值进行暴力破解,验证通过随机数发生器产生的是否为帧中模数 N 的因 子,从而对 N 进行分解,得到 RSA 的所有参数。可得其中 16 个帧的 p 和 q 值。有了 p 和 q 即可方便地计算 \(\phi(n)\),从而获得所有的参数,包括私钥 d 以及解密出的明文 x。其余的 5 个帧由于不是由 16bit 的整数倍构成的,对其进行生成后截取前 n 位进行破解,最终也能得到 N 的分解。或者去网上搜索已经获得的明文也是可以的。
最终可以由所有帧的参数获得最终的明文:
1 2
My secret is a famous saying of Albert Einstein. That is "Logic will get you from A to B. Imagination will take you everywhere."