您的位置:首页 > 娱乐 > 八卦 > web技术包括哪些_有网址的公司_近期国内外重大新闻10条_今日西安头条最新消息

web技术包括哪些_有网址的公司_近期国内外重大新闻10条_今日西安头条最新消息

2024/10/5 23:21:38 来源:https://blog.csdn.net/qq_30220519/article/details/142549913  浏览:    关键词:web技术包括哪些_有网址的公司_近期国内外重大新闻10条_今日西安头条最新消息
web技术包括哪些_有网址的公司_近期国内外重大新闻10条_今日西安头条最新消息
目标

密码生成
// Function to generate a random password
std::string generatePassword(int length, bool includeUpper, bool includeNumbers, bool includeSymbols) {std::string lower = "abcdefghijklmnopqrstuvwxyz";std::string upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";std::string numbers = "0123456789";std::string symbols = "!@#$%^&*()_+-=[]{}|;:',.<>?/`~";std::string characters = lower;if (includeUpper) characters += upper;if (includeNumbers) characters += numbers;if (includeSymbols) characters += symbols;std::random_device rd;std::mt19937 generator(rd());std::uniform_int_distribution<> dist(0, characters.size() - 1);std::string password;for (int i = 0; i < length; ++i) {password += characters[dist(generator)];}return password;
}
def generate_strong_password(length):characters = string.ascii_letters + string.digits + string.punctuationpassword = ''.join(random.choice(characters) for i in range(length))return password

 

 密码检测
// Function to assess password strength
std::string assessPasswordStrength(const std::string& password, bool includeUpper, bool includeNumbers, bool includeSymbols) {int length = password.length();bool hasLower = false, hasUpper = false, hasDigit = false, hasSymbol = false;for (char c : password) {if (islower(c)) hasLower = true;if (isupper(c)) hasUpper = true;if (isdigit(c)) hasDigit = true;if (ispunct(c)) hasSymbol = true;}// Determine password strengthif (length >= 12 && hasLower && hasUpper && hasDigit && hasSymbol) {return GREEN;  // Strong} else if (length >= 8 && ((hasUpper && hasLower) || (hasLower && hasDigit) || (hasUpper && hasDigit))) {return YELLOW;  // Medium} else {return RED;  // Weak}
}
 效果

pass.exe -l 12 -u -n -s

i7{wQx?qkr-<

参考

GitHub - anlaki-py/pass-gen: Simple/secure password generator that you can quickly run everywhere in your terminal.

C++密码安全检测-CSDN博客


创作不易,小小的支持一下吧!

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com