Chinaunix首页 | 论坛 | 博客
  • 博客访问: 212953
  • 博文数量: 70
  • 博客积分: 2050
  • 博客等级: 大尉
  • 技术积分: 700
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-15 21:42
文章分类

全部博文(70)

文章存档

2013年(1)

2011年(5)

2010年(3)

2009年(9)

2008年(17)

2007年(6)

2006年(29)

我的朋友

分类: C/C++

2006-09-01 17:50:26

#include "rsa.h"

int
main(void)
{
    int l;
    bignum_t moduluspubkeyprikey;
    char b[1024], cipher[128], plain[128];
    char *msg = "hello, world.";

    l = strpmem("81FA179F7E123D9CFDFD80B95A1EEBD78D686C76A08A67BA9E7C21F30ABF157CC42B3962C9CC57FEBA0D01A8827354C1F2BF4D810A0F650E97F441945DE2982641CABD0361E142182DDDEA0AA620ED5D0E42C0796E14191E452EA322AE9ABE75F9B175ED618080042AD2E59C56A14BF1DAFC6D30AB62A8A560DA0F2CCF2CB649"b);
    modulus = bignum_from_bytes(bl);
    pubkey = bignum_from_long(0x7B5);
    l = strpmem("4AA3BA43D8295B0B860C0F66EF80B1BB5C1A5C20D45743BDB041D57966F74464528C4CF09665A51A209F47471381EFED1AC61651C1A84E24CBC6E9958E88BD5A8910BE8C4BB09A29826AC65B369D4F9A553E84154C43F0F85EEE477DBC1DBBC4059C76480FDD182B774EC2522397EEF1AC7ADF99F97720FCBE6B8CE9CDA76EC1"b);
    prikey = bignum_from_bytes(bl);

    l = rsa(ciphermsgstrlen(msg), moduluspubkey);
    strmem(bcipherl);
    printf("ciphertext: %s\n"b);

    l = rsa(plaincipherlmodulusprikey);
    printf("plain: %.*s\n"lplain);

    return 0;
}
文件: RSA.zip
大小: 64KB
下载: 下载
阅读(1298) | 评论(0) | 转发(0) |
0

上一篇:PV/UV/PR(转)

下一篇:soundex

给主人留下些什么吧!~~