Browse Source

Attempt to fix short passwords on mac+win

pull/112/head
Duke 1 year ago
parent
commit
a557e25b61
  1. 8
      src/connection.cpp

8
src/connection.cpp

@ -152,11 +152,17 @@ QString randomPassword() {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"; "abcdefghijklmnopqrstuvwxyz";
const int passwordLength = 10; // Assume we have low entropy randomness,
// so we generate a longer password than we probably need
const int passwordLength = 32;
char* s = new char[passwordLength + 1]; char* s = new char[passwordLength + 1];
for (int i = 0; i < passwordLength; ++i) { for (int i = 0; i < passwordLength; ++i) {
#ifdef Q_OS_LINUX
s[i] = alphanum[randombytes_uniform(sizeof(alphanum))]; s[i] = alphanum[randombytes_uniform(sizeof(alphanum))];
#else
s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
#endif
} }
s[passwordLength] = 0; s[passwordLength] = 0;

Loading…
Cancel
Save