|
|
|
[原创]IDEA中2^16 + 1的模乘运算的一种优化实现。
0表示2^16?为什么要这样?不明白。如果模数是2^16的话还可以理解。 |
|
[原创]IDEA中2^16 + 1的模乘运算的一种优化实现。
我们用M来代替2^16 + 1 如果结果为负值则应该加上M 后取低16位。 a. b中有一个为0, 这里假设a = 0; a ^ b mod M = 2^16 * b mod M = M * b - b mod M = M - b mod M = 2^16 + 1 - b mod M = 1 - b mod M =========== 从红色的部分看,貌似还是要用到这个数啊。不懂汇编的路过,希望有C语言版本的。 设a=ah*2^8+al;b=bh*2^8+bl; a*b=ah*bh*2^16+(ah*bl+al*bh)*2^8+al*bl; 在模2^16+1的情况下 a*b=(ah*bl+al*bh)*2^8+al*bl-ah*bh 应该注意到ah*bl+al*bh>2^8的时候,也就是a*b=(ah*bl+al*bh)*2^8+al*bl-ah*bh>2^16+1,这时候并没有完成模运算。 0<=ah,al,bh,bl<=0xff,因而0<=ah*bl+al*bh<=0x1ffff.于是得到方法: a*b=(((ah*bl+al*bh)&0xff)<<8) + al*bl-ah*bh-((ah*bl+al*bh)>>8) 另外似乎a=0或者b=0都有ab=0(mod N) |
|
[原创]现学现卖——Vigenere加密法
那个表怎么会是24*26的呢?我一开始以为是26*26的。看了一下13楼写的那个程序,莫非对Key有限制?a和y怎么区别? 对于某个密文,如果估算出Pa^2,那么MR就能确定。由于Pa为从密文中选取字母a的概率,那么Pa^2就是从全部密文中选取字母a的概率和从剩余密文 中(即去掉第一个a字母的密文)中选取的字母a的概率的倍数。如果密文中有n个a字母,Fa是密文中a字母的个数,那么Pa=Fa/n,Pa^2=(Fa /n)[(Fa-1)/(n-1)]。(这一段完全抄书,我对Pa^2的计算不太理解,概率平方后加起来是不是一了?,我说不太清楚,概率论考试也挂了, 哎) ==================== 对于这段,我是这样理解的。Pa^2就是连续两次都取到同一个字母的概率。因为密文一旦给出就确定下来了,所以不能两次都取同一个字母。看起来有点熵的感觉,突然想到了几年前学的信息学。 |
|
[推荐]+[分享]數位資訊及電腦安全防護 -- SecuInHand 8.1 專業版
会被木马盯上,泄漏用户密码吗?和一些主流的杀毒软件有冲突吗?期待更多的测试。 |
|
[推荐]+[分享]數位資訊及電腦安全防護 -- SecuInHand 8.1 專業版
确实如此,很多保护软件只关注保护系统,却忘记了要保护自己 |
|
|
|
[原创]放个Pdf重命名小工具大家用
参考:http://bbs.pediy.com/showthread.php?p=743379 其实如果只是提取/Title里的信息的话,可以参考上面的介绍的pdf格式提取。我看了一下,发现很多pdf的/Title属性都是不正确的,或者为空,或者与文章主题无关。 反正还是挺麻烦的。如果提取第一个object的话,对于有些pdf来说可能有页头信息,第一个对象未必是标题,总之挺麻烦的。 |
|
|
|
|
|
[求助]如何用Crypto++实现DES???
没有doc吗? http://www.cryptopp.com/ http://sourceforge.net/projects/cryptopp/ 这几个都是可以参考的。 或者通过SVN获取最新的文档。 svn co https://cryptopp.svn.sourceforge.net/svnroot/cryptopp cryptopp 这个是早期4.0版本的DES加密函数包含DES.h就可以了 enum CipherDir {ENCRYPTION, DECRYPTION}; DES::DES(const byte *key, CipherDir dir)这个是类的构造函数 void DES::ProcessBlock(const byte *inBlock, byte * outBlock) const 现在最新的是5.60了,看起来更麻烦了,大量使用了C++的模板类的东西。 在其中的DES.h文件中发现这么一句: // disable DES in DLL version by not exporting this function 如果还是坚持要用的话,可能需要先修改为导出该方法才可以。 static const char * StaticAlgorithmName() {return "DES";} 在前面加上CRYPTOPP_DLL 就可以了。5.60的也可以类似修改。 另外还有一个地方也是要修改的,仔细找找就是了。这个库很大,每次我修改代码之后重新编译都很慢,郁闷了。 可以这样来写 DES::Encryption encryption_DES; encryption_DES.SetKey(key, DES::KEYLENGTH); encryption_DES.ProcessBlock(plaintext, ciphertext); DES::Decryption decryption_DES; decryption_DES.SetKey(key, DES::KEYLENGTH); decryption_DES.ProcessBlock(ciphertext, decrypted); if (memcmp(plaintext, decrypted, 24) != 0) { cerr << "DES Encryption/decryption failed.\n"; abort(); } cout << "DES Encryption/decryption succeeded.\n"; 另外我发现代码中给出的DES3的代码是这样的: CFB_FIPS_Mode<DES_EDE3>::Encryption encryption_DES_EDE3_CFB; encryption_DES_EDE3_CFB.SetKeyWithIV(key, sizeof(key), iv); encryption_DES_EDE3_CFB.ProcessString(ciphertext, plaintext, 24); CFB_FIPS_Mode<DES_EDE3>::Decryption decryption_DES_EDE3_CFB; decryption_DES_EDE3_CFB.SetKeyWithIV(key, sizeof(key), iv); decryption_DES_EDE3_CFB.ProcessString(decrypted, ciphertext, 24); if (memcmp(plaintext, decrypted, 24) != 0) { cerr << "DES-EDE3-CFB Encryption/decryption failed.\n"; abort(); } cout << "DES-EDE3-CFB Encryption/decryption succeeded.\n"; 我尝试过套用相同的模板,可是在运行时会出错,如果按照CFB_FIPS_Mode来分类,DES属于那种?我还尝试过CFB_Mode也出错。。 再好奇问问,DES不用设置IV的吗?我对DES调用SetKeyWithIV就会出错,DES3则没错。还是说IV对于DES和DES3来说长度是不一样的? 这个问题问得似乎有点新人了。 |
|
梵听版質數產生器--Improved by Loka
这样的代码可读性太差了。最好有些注释,谢谢。 |
|
[分享]RSA-768 將可能在 2010年1月破解。
http://en.wikipedia.org/wiki/RSA-768#RSA-768 奇怪了,我在上面那个地址看到,说RSA-768在09年就被破解了。相关信息如下: RSA-768 has 232 decimal digits and has been factored on December 12, 2009 by Thorsten Kleinjung, Kazumaro Aoki, Jens Franke, Arjen K. Lenstra, Emmanuel Thomé, Pierrick Gaudry, Alexander Kruppa, Peter Montgomery, Joppe W. Bos, Dag Arne Osvik, Herman te Riele, Andrey Timofeev, and Paul Zimmermann. [26] RSA-768 = 12301866845301177551304949583849627207728535695953347921973224521517264005 07263657518745202199786469389956474942774063845925192557326303453731548268 50791702612214291346167042921431160222124047927473779408066535141959745985 6902143413 RSA-768 = 33478071698956898786044169848212690817704794983713768568912431388982883793 878002287614711652531743087737814467999489 × 36746043666799590428244633799627952632279158164343087642676032283815739666 511279233373417143396810270092798736308917 郁闷,居然在[26]里引用的是2010年的文章。 |
|
[分享]RSA-768 將可能在 2010年1月破解。
NFS是主流啊。 |
|
[分享]破解 RSA 的兩篇論文方法。
那篇文章是什么意思啊? These attacks allow to factor the modulus N given a single faulty signature. 这句话怎么理解啊? 给一个单一的有错误的签名,就能分解N??? 太恐怖了吧,2048bit的不用一分钟就能分解。。。。。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值