2 个不稳定版本
0.2.0 | 2021 年 9 月 7 日 |
---|---|
0.1.0 | 2021 年 9 月 3 日 |
#4 in #dist
14KB
266 行
PassGen
PassGen 是一个简单的命令行工具,用于生成符合所需(简单约束)的伪随机密码
使用方法(作为工具)
passg 0.2.0
PassGen is a tool that lets you generate pseudo-random passwords from the command line
USAGE:
passg [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-a, --alpha <alpha> What kind of alphabetic characters do you want to allow ? (all = 'all', none = 'none',
easily distinguished = 'dist' [eg removes O vs 0], lower case = 'lower', upper case =
'upper') [default: dist]
-d, --digit <digit> What kind of numeric characters do you want to allow ? (all = 'all', none = 'none',
easily distinguished = 'dist' [eg removes O vs 0]) [default: dist]
-l, --length <length> The length of the password [default: 20]
-s, --special <special> What kind of special characters do you want to allow ? (all = 'all', none = 'none', the
most common ones = 'basic') [default: basic]
使用方法(作为库)
该包的文档提供了一个如何生成随机密码的示例。基本上,你可能需要做以下类似的事情
use passg::prelude::*;
let generator = GeneratorBuilder::default()
.alpha(Alpha::Dist) // this is the default
.digit(Digit::Dist) // this is the default
.special(Special::Basic) // this is the default
.build()
.expect("This is never going to fail")
依赖关系
~3MB
~48K SLoC