(要测试代码的发email给wwb206@163.com)
而且主流rsa算法都建立在512位到1024位的.而现有的计算机 【程序编程相关:介绍.NET中的委派(Delegates】前几天不忙,于是想起加密算法,但是rsa加密是依赖大数运算, 【推荐阅读:介绍.NET中的委派(Delegates】
cxword来实现1024位的大数运算. 【扩展信息:代理服务器的源程序】数据类型最大的也就是64(int64),于是自己编了一个大数类基本思想就是用dword[32]的数组来存储,具体实现如下.(为加快运行速度,所有的函数都是内联的)/****************************************************************/file://长word数头文件:cxword.hfile://作者:wwb206@163.comfile://版本:1.0 (2004.2.17)file://说明: 将大数看作一个n进制数组,对于目前的32位系统而言n可以取file://值为2的32次方,即0x00000000 <> 0xffffffff/****************************************************************/ file://#if !defined wwb_xword2004021711025632100#ifndef wwb_xword2004021711025632100#define wwb_xword2004021711025632100file://#define wwb_xworddebugfile://数组位数,表示可表示的最大数是2^(32*32)=2^1024,即可表示1024位数const dword xwordlen= 32; class cxword{private: dword data[xwordlen];//重载 []等public: inline int getlen() const; inline cxword loffset(int value); inline cxword operator+(const cxword value) const; inline cxword operator+(const dword value)const; inline cxword operator-(const cxword value)const; inline cxword operator-(const dword value)const; inline cxword operator*(const cxword value)const; inline cxword operator*(const dword value)const; inline cxword operator/(const cxword value)const; inline cxword operator/(const dword value)const; inline cxword operator%(const cxword value)const; inline dword operator%(const dword value)const; inline cxword operator=(const cxword value); inline cxword operator=(const dword value); inline cxword operator<<(const dword bitcount); inline cxword operator>>(const dword bitcount);... 下一页