shaojunhan / rsa Goto Github PK
View Code? Open in Web Editor NEWC++ code of 1024 rsa
C++ code of 1024 rsa
0.BigInt有符号大整数类 0.1加、减、乘、除、模 0.2欧几里得扩展算法求乘法逆元 0.3模乘 1.Rsa 1.1大素数生成 1.2米勒拉宾算法大素数检测 1.3公私钥加解密 2.main() 2.1十六进制输入数据,输入时不能有空格 2.2初始、加密、解密、显示公私钥 2.3 go运行函数,test测试函数 3.Rsa初始化时间 3.0 16位:0s 3.1 32位:0s 3.1 64位:0s 3.2 128位:0s 3.3 256位:1s 3.4 512位:20s 3.5 1024位:47s 3.6 2048位:968s
个人认为由于未使用快速模幂算法。
如题
a=a>>(BigInt::basebitnum);//BigInt::basebitnum = 32
在copyFromLong里,这个语句好像没什么意义,不是把a设为0吗。不知道作者您的意图,希望指点一下。另外,通过学习你的代码学到了很多,谢谢。
把代码加入到动态库中后,一加载动态库就失败,get错误 3765269347,应该是出在BigInt里面,但是没定位到问题
Line 175 in 61a3eb7
1右移32位在vs2010 debug模式下还是1. 32位整型右移32位是未定义行为,会引起bug
C99中,对右移有这样的规定:
If the value of the right operand is negative or is
greater than or equal to the width of the promoted left operand, the behavior is undefined.
如题
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff * 0xffffffffffffffff 应为0xfffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffff0000000000000001。但是结果为0xFFFFFFDFFFFFFFC0FFFFFFC1FFFFFFC1FFFFFFC1FFFFFFC1FFFFFFC1FFFFFFC1FFFFFFE100000001.
可见:0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff * 0xffffffffffffffff / 0xffffffffffffffff != 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
用debug编译后程序不能正常运行,无法进入main函数
Line 56 in 61a3eb7
if (n == BigInt::One) return false;
也许可以使用更优秀的质数生成算法,而不是while嵌套
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.