Skip to content

Commit

Permalink
Simplify loop to write bytes to password
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
  • Loading branch information
claucambra committed Jul 21, 2023
1 parent a306ace commit 67ef758
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/gui/filedetails/sharemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ QString createRandomPassword()

RAND_bytes(unsignedCharArray.data(), numChars);

for (auto i = 0; i < numChars; i++) {
auto byte = unsignedCharArray[i];
byte %= asciiRange + 1;
byte += asciiMin;
for (const auto newChar : unsignedCharArray) {
// Ensure byte is within asciiRange
const auto byte = (newChar % (asciiRange + 1)) + asciiMin;
passwd.append(byte);
}

Expand Down

0 comments on commit 67ef758

Please sign in to comment.