MCPcopy Create free account
hub / github.com/IJHack/QtPass / generateRandomPassword

Method generateRandomPassword

src/pass.cpp:879–890  ·  view source on GitHub ↗

* @brief Generates a random password from the given charset. * @param charset Characters to use in the password * @param length Desired password length * @return Generated password string */

Source from the content-addressed store, hash-verified

877 * @return Generated password string
878 */
879auto Pass::generateRandomPassword(const QString &charset, unsigned int length)
880 -> QString {
881 if (charset.isEmpty() || length == 0U) {
882 return {};
883 }
884 QString out;
885 for (unsigned int i = 0; i < length; ++i) {
886 out.append(charset.at(static_cast<int>(
887 boundedRandom(static_cast<quint32>(charset.length())))));
888 }
889 return out;
890}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected