資源簡介
MD2
MD5
SHA-1
HAVAL
Tiger
RIPE-MD160
MD5-MAC
HMAC
XOR-MAC
DES
IDEA
WAKE
3-WAY
TEA
SAFER
Blowfish
SHARK
GOST
CAST-128
Square
Diamond2
Sapphire
RC2
RC5
RC6
MARS
SEAL
Luby-Rackoff
MDC
various encryption modes (CFB, CBC, OFB, counter)
DH
DH2
MQV
DSA
NR
ElGamal
LUC
LUCDIF
LUCELG
Rabin
RW
RSA
BlumGoldwasser
elliptic curve cryptosystems
BBS
DEFLATE compression
Shamir's secret sharing scheme
Rabin's information dispersal scheme.
There are also various miscellanous modules such as base 64 coding and 32-bit CRC.

代碼片段和文件信息
//?3way.cpp?-?modifed?by?Wei?Dai?from?Joan?Daemen‘s?3way.c
#include?“pch.h“
#include?“3way.h“
NAMESPACE_BEGIN(CryptoPP)
static?const?word32?START_E?=?0x0b0b;?//?round?constant?of?first?encryption?round
static?const?word32?START_D?=?0xb1b1;?//?round?constant?of?first?decryption?round
static?inline?word32?reverseBits(word32?a)
{
a?=?((a?&?0xAAAAAAAAL)?>>?1)?|?((a?&?0x55555555L)?<1);
a?=?((a?&?0xCCCCCCCCL)?>>?2)?|?((a?&?0x33333333L)?<2);
return?((a?&?0xF0F0F0F0L)?>>?4)?|?((a?&?0x0F0F0F0FL)?<4);
}
#define?mu(a0?a1?a2) \
{ \
a1?=?reverseBits(a1); \
word32?t?=?reverseBits(a0); \
a0?=?reverseBits(a2); \
a2?=?t; \
}
#define?pi_gamma_pi(a0?a1?a2) \
{ \
word32?b0?b2; \
b2?=?rotl(a2?1U); \
b0?=?rotl(a0?22U); \
a0?=?rotl(b0?^?(a1|(~b2))?1U); \
a2?=?rotl(b2?^?(b0|(~a1))?22U);\
a1?^=?(b2|(~b0)); \
}
//?thanks?to?Paulo?Barreto?for?this?optimized?theta()
#define?theta(a0?a1?a2) \
{? \
word32?b0?b1?c;? \
c?=?a0?^?a1?^?a2;? \
c?=?rotl(c?16U)?^?rotl(c?8U);? \
b0?=?(a0?<24)?^?(a2?>>?8)?^?(a1?<8)?^?(a0?>>?24);? \
b1?=?(a1?<24)?^?(a0?>>?8)?^?(a2?<8)?^?(a1?>>?24);? \
a0?^=?c?^?b0;? \
a1?^=?c?^?b1;? \
a2?^=?c?^?(b0?>>?16)?^?(b1?<16);? \
}
#define?rho(a0?a1?a2) \
{ \
theta(a0?a1?a2); \
pi_gamma_pi(a0?a1?a2); \
}
static?void?GenerateRoundConstants(word32?strt?word32?*rtab?unsigned?int?rounds)
{
for(unsigned?i=0;?i<=rounds;?i++)
{
rtab[i]?=?strt;
strt?<<=?1;
if?(strt&0x10000)?strt?^=?0x11011;
}
}
ThreeWayEncryption::ThreeWayEncryption(const?byte?*uk?unsigned?rounds)
:?rounds(rounds)?rc(rounds+1)
{
GenerateRoundConstants(START_E?rc?rounds);
for?(int?i=0;?i<3;?i++)
k[i]?=?(word32)uk[4*i+3]?|?((word32)uk[4*i+2]<<8)?|?((word32)uk[4*i+1]<<16)?|?((word32)uk[4*i]<<24);
}
ThreeWayEncryption::~ThreeWayEncryption()
{
k[0]=k[1]=k[2]=0;
}
void?ThreeWayEncryption::ProcessBlock(const?byte?*in?byte?*?out)?const
{
word32?a0?a1?a2;
#ifdef?IS_LITTLE_ENDIAN
a0?=?byteReverse(*(word32?*)in);
a1?=?byteReverse(*(word32?*)(in+4));
a2?=?byteReverse(*(word32?*)(in+8));
#else
a0?=?*(word32?*)in;
a1?=?*(word32?*)(in+4);
a2?=?*(word32?*)(in+8);
#endif
for(unsigned?i=0;?i {
a0?^=?k[0]?^?(rc[i]<<16);
a1?^=?k[1];
a2?^=?k[2]?^?rc[i];
rho(a0?a1?a2);
}
a0?^=?k[0]?^?(rc[rounds]<<16);
a1?^=?k[1];
a2?^=?k[2]?^?rc[rounds];
theta(a0?a1?a2);
#ifdef?IS_LITTLE_ENDIAN
*(word32?*)out?=?byteReverse(a0);
*(word32?*)(out+4)?=?byteReverse(a1);
*(word32?*)(out+8)?=?byteReverse(a2);
#else
*(word32?*)out?=?a0;
*(word32?*)(out+4)?=?a1;
*(word32?*)(out+8)?=?a2;
#endif
}
ThreeWayDecryption::ThreeWayDecryption(const?byte?*uk?unsigned?rounds)
:?rounds(rounds)?rc(rounds+1)
{
GenerateRoundConstants(START_D?rc?rounds);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1194??1998-12-12?14:23??C++加解密算法源代碼大全\3way.h
?????文件???????7012??1998-12-29?23:53??C++加解密算法源代碼大全\algebra.h
?????文件???????1486??1998-12-18?19:17??C++加解密算法源代碼大全\asn.h
?????文件???????1087??1998-12-12?14:23??C++加解密算法源代碼大全\ba
?????文件????????104??1998-11-19?12:11??C++加解密算法源代碼大全\bench.h
?????文件???????1177??1998-12-12?14:23??C++加解密算法源代碼大全\blowfish.h
?????文件???????1463??1998-12-12?14:23??C++加解密算法源代碼大全\blumgold.h
?????文件???????1107??1998-12-12?14:23??C++加解密算法源代碼大全\blumshub.h
?????文件???????1178??1998-12-12?14:23??C++加解密算法源代碼大全\cast.h
?????文件???????1997??1998-12-12?14:23??C++加解密算法源代碼大全\cbc.h
?????文件???????3258??1998-12-18?19:17??C++加解密算法源代碼大全\config.h
?????文件????????707??1998-12-12?14:23??C++加解密算法源代碼大全\crc.h
?????文件??????22994??1999-01-01?00:04??C++加解密算法源代碼大全\cryptlib.h
?????文件???????1084??1998-12-12?14:23??C++加解密算法源代碼大全\default.h
?????文件???????2599??1998-12-12?14:23??C++加解密算法源代碼大全\des.h
?????文件???????1607??1998-12-29?23:53??C++加解密算法源代碼大全\dh2.h
?????文件???????2868??1998-12-12?14:23??C++加解密算法源代碼大全\diamond.h
?????文件???????2777??1998-12-18?19:17??C++加解密算法源代碼大全\dsa.h
?????文件???????2735??1998-12-29?23:53??C++加解密算法源代碼大全\ec2n.h
?????文件???????6687??1998-12-31?20:37??C++加解密算法源代碼大全\eccrypto.h
?????文件???????2944??1998-12-29?23:53??C++加解密算法源代碼大全\ecp.h
?????文件???????1795??1998-12-18?19:18??C++加解密算法源代碼大全\elgamal.h
?????文件???????1482??1998-12-12?14:23??C++加解密算法源代碼大全\eprecomp.h
?????文件???????1566??1998-12-18?19:18??C++加解密算法源代碼大全\files.h
?????文件???????2648??1998-12-12?14:23??C++加解密算法源代碼大全\filters.h
?????文件???????3221??1998-12-12?14:23??C++加解密算法源代碼大全\forkjoin.h
?????文件???????1243??1998-12-12?14:23??C++加解密算法源代碼大全\gf2_32.h
?????文件???????1233??1998-12-12?14:23??C++加解密算法源代碼大全\gf256.h
?????文件???????8758??1998-12-29?23:53??C++加解密算法源代碼大全\gf2n.h
?????文件???????1113??1998-12-12?14:23??C++加解密算法源代碼大全\gost.h
............此處省略203個文件信息
- 上一篇:基于c語言的語音識別程序
- 下一篇:OpenMP并行計算程序設計基礎 pdf高清版
評論
共有 條評論