Refactor free functions into RandomNumbers

This commit is contained in:
Vinnie Falco
2013-06-04 12:38:54 -07:00
parent 882102e9fd
commit 0523d6a054
16 changed files with 223 additions and 54 deletions

View File

@@ -105,7 +105,7 @@ std::vector<unsigned char> CKey::encryptECIES(CKey& otherKey, const std::vector<
{
ECIES_ENC_IV_TYPE iv;
getRand(static_cast<unsigned char *>(iv.begin()), ECIES_ENC_BLK_SIZE);
RandomNumbers::getInstance ().fillBytes (iv.begin (), ECIES_ENC_BLK_SIZE);
ECIES_ENC_KEY_TYPE secret;
ECIES_HMAC_KEY_TYPE hmacKey;
@@ -268,7 +268,7 @@ bool checkECIES(void)
std::vector<unsigned char> message(4096);
int msglen = i%3000;
getRand(static_cast<unsigned char *>(&message.front()), msglen);
RandomNumbers::getInstance ().fillBytes (&message.front(), msglen);
message.resize(msglen);
// encrypt message with sender's private key and recipient's public key

View File

@@ -803,7 +803,7 @@ void RippleAddress::setSeedRandom()
// XXX Maybe we should call MakeNewKey
uint128 key;
getRand(key.begin(), key.size());
RandomNumbers::getInstance ().fillBytes (key.begin(), key.size());
RippleAddress::setSeed(key);
}

View File

@@ -57,6 +57,7 @@
#include "crypto/ripple_CBigNum.h"
#include "crypto/ripple_Base58.h" // VFALCO: TODO, Can be moved to .cpp if we clean up setAlphabet stuff
#include "crypto/ripple_Base58Data.h"
// #include "src/cpp/ripple/ProofOfWork.h"
#include "protocol/ripple_FieldNames.h"
#include "protocol/ripple_RippleAddress.h"