summaryrefslogtreecommitdiff
path: root/test.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-05-04 15:38:32 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-05-04 15:38:32 +0000
commite893a752d7bf74c9692cad5f058a190a6a047210 (patch)
treead77c798110d040680e92eb3bf46523222bca155 /test.cpp
parent0cee348b78bdb6ef7da48ae6682c17dd75dc2fd4 (diff)
downloadcryptopp-e893a752d7bf74c9692cad5f058a190a6a047210.tar.gz
add IncorporateEntropy and GenerateIntoBufferedTransformation to RNG interface
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@342 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'test.cpp')
-rw-r--r--test.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/test.cpp b/test.cpp
index 34a7388..1845348 100644
--- a/test.cpp
+++ b/test.cpp
@@ -2,7 +2,7 @@
#define _CRT_SECURE_NO_DEPRECATE
#define CRYPTOPP_DEFAULT_NO_DLL
-#define CRYPTOPP_ENABLE_NAMESPACE_WEAK
+#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
#include "dll.h"
#include "md5.h"
@@ -355,7 +355,7 @@ int CRYPTOPP_API main(int argc, char *argv[])
void FIPS140_GenerateRandomFiles()
{
#ifdef OS_RNG_AVAILABLE
- AutoSeededX917RNG<DES_EDE3> rng;
+ DefaultAutoSeededRNG rng;
RandomNumberStore store(rng, ULONG_MAX);
for (unsigned int i=0; i<100000; i++)
@@ -374,7 +374,7 @@ SecByteBlock HexDecodeString(const char *hex)
return result;
}
-RandomPool & GlobalRNG()
+RandomNumberGenerator & GlobalRNG()
{
static RandomPool randomPool;
return randomPool;
@@ -383,7 +383,7 @@ RandomPool & GlobalRNG()
void GenerateRSAKey(unsigned int keyLength, const char *privFilename, const char *pubFilename, const char *seed)
{
RandomPool randPool;
- randPool.Put((byte *)seed, strlen(seed));
+ randPool.IncorporateEntropy((byte *)seed, strlen(seed));
RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength);
HexEncoder privFile(new FileSink(privFilename));
@@ -402,7 +402,7 @@ string RSAEncryptString(const char *pubFilename, const char *seed, const char *m
RSAES_OAEP_SHA_Encryptor pub(pubFile);
RandomPool randPool;
- randPool.Put((byte *)seed, strlen(seed));
+ randPool.IncorporateEntropy((byte *)seed, strlen(seed));
string result;
StringSource(message, true, new PK_EncryptorFilter(randPool, pub, new HexEncoder(new StringSink(result))));
@@ -544,7 +544,7 @@ void SecretShareFile(int threshold, int nShares, const char *filename, const cha
assert(nShares<=1000);
RandomPool rng;
- rng.Put((byte *)seed, strlen(seed));
+ rng.IncorporateEntropy((byte *)seed, strlen(seed));
ChannelSwitch *channelSwitch;
FileSource source(filename, false, new SecretSharing(rng, threshold, nShares, channelSwitch = new ChannelSwitch));
@@ -774,7 +774,7 @@ bool Validate(int alg, bool thorough, const char *seed)
}
cout << "Using seed: " << seed << endl << endl;
- GlobalRNG().Put((const byte *)seed, strlen(seed));
+ GlobalRNG().IncorporateEntropy((const byte *)seed, strlen(seed));
switch (alg)
{
@@ -843,6 +843,7 @@ bool Validate(int alg, bool thorough, const char *seed)
case 63: result = ValidateTTMAC(); break;
case 64: result = ValidateSalsa(); break;
case 65: result = ValidateSosemanuk(); break;
+ case 66: result = ValidateVMAC(); break;
default: return false;
}