当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: (要测试代码的发Email给wwb206@163.com) 前几天不忙,于是想起加密算法,但是RSA加密是依赖大数运算,而且主流RSA算法都建立在512位到1024位的。
 

 

 ·vc调试技术小技巧(2)    »显示摘要«
    摘要: #ifndef xtib_h #define xtib_h // call setthreadname(), and then paste this expression into the watch window: // (char*)(dw(@tib+0x14)) #pragma pack(1) typedef struct _exception_registrat......
    摘要: 不知道大家用过ncx99.exe没有,这个小工具很有用,运行后,它bind到一个端口,并接管cmd.exe的输入输出,使得远程用户得到一个shell来实现各种操作,不需要特别的客户端,只要用windows自带的telnet客户端就可以了。下面我给出类似这个工具的source code,我这个工具和ncx99.exe有点不一样,用到了远程线程插入技术,将ncx99.exe功能封装在一个dll里,然......


大数运算和RSA算法

(要测试代码的发email给wwb206@163.com)

而且主流rsa算法都建立在512位到1024位的.而现有的计算机 【程序编程相关:介绍.NET中的委派(Delegates

前几天不忙,于是想起加密算法,但是rsa加密是依赖大数运算, 【推荐阅读:介绍.NET中的委派(Delegates

cxword来实现1024位的大数运算. 【扩展信息:代理服务器的源程序

数据类型最大的也就是64(int64),于是自己编了一个大数类

基本思想就是用dword[32]的数组来存储,具体实现如下.

(为加快运行速度,所有的函数都是内联的)

/****************************************************************/

file://长word数头文件:cxword.h

file://作者:wwb206@163.com

file://版本:1.0 (2004.2.17)

file://说明: 将大数看作一个n进制数组,对于目前的32位系统而言n可以取

file://值为2的32次方,即0x00000000 <> 0xffffffff

/****************************************************************/

file://#if !defined wwb_xword2004021711025632100

#ifndef wwb_xword2004021711025632100

#define wwb_xword2004021711025632100

file://#define wwb_xworddebug

file://数组位数,表示可表示的最大数是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);


...   下一页
 ·马走日棋盘算法    »显示摘要«
    摘要: 问题描述在给定大小的方格状棋盘上, 将棋子”马”放在指定的起始位置 , 棋子”马” 的走子的规则为必须在棋盘上走”日”字; 从棋子”马”的起始位置开始, 搜索出一条可行的路径, 使得棋子”马”能走遍棋盘上的所有落子点, 而且每个落子点只能走一次; 例如: 棋盘大小为5*5 , 棋子马放的起始落子点为 ( 3 , 3 ) ; 算法需要搜索一条从位置( 3 , 3 ) 开始的一条包括......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE