summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cryptor.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/Cryptor.cpp b/Cryptor.cpp
index 25a2ae9..9db2bdc 100644
--- a/Cryptor.cpp
+++ b/Cryptor.cpp
@@ -153,9 +153,7 @@ std::string Cryptor::loadAndDecrypt(std::string remoteHost, std::string port, st
}
std::string Cryptor::createRandomPassword(PasswordSpec spec) {
- CryptoPP::AutoSeededRandomPool randl;
std::string password;
-
std::vector<char> validChars;
// Always allow lower-case alphabetic characters
@@ -208,14 +206,11 @@ std::string Cryptor::createRandomPassword(PasswordSpec spec) {
validChars.push_back('0' + i);
}
-
// Build string
for (int i = 0; i < spec.ml; i++) {
- unsigned char r[1];
- char c;
- randl.GenerateBlock(r, sizeof(r));
- c = validChars[r[0] % validChars.size()];
- password += c;
+ unsigned char c;
+ generateRandom(&c, sizeof(c));
+ password += validChars[c % validChars.size()];
}
return password;