#password-generator #password #generator #cli-password #cli

无std 程序+库 lesspass

LessPass密码生成器的有效实现

3 个版本 (破坏性更新)

0.4.0 2021年12月7日
0.2.0 2019年1月5日
0.1.0 2018年10月13日

2038算法 中排名

每月下载量 48
用于 lesspass-client

GPL-3.0-only

37KB
501

lesspass.rs

LessPass的(非官方)全功能Rust客户端。

此客户端专注于性能:尽可能避免分配,并对密码生成算法的一些部分进行了轻微更改,以避免不必要的分配。

用法

Generates LessPass-like passwords.

USAGE:
    lesspass.exe [FLAGS] [OPTIONS] [ARGS]

FLAGS:
    -L, --no-lower          Exclude lowercase characters.
    -N, --no-numbers        Exclude numbers.
    -S, --no-symbols        Exclude symbols.
    -U, --no-upper          Exclude uppercase characters.
    -h, --help              Prints help information
    -E, --return-entropy    Return the entropy instead of generating a password.
        --sha256            Use SHA-256 for password generation.
        --sha384            Use SHA-384 for password generation.
        --sha512            Use SHA-512 for password generation.
    -V, --version           Prints version information

OPTIONS:
    -c, --counter <counter>          Arbitrary number used for password generation. [default: 1]
    -i, --iterations <iterations>    Number of iterations used for entropy generation. [default: 100000]
    -l, --length <length>            Length of the generated password. [default: 16]

ARGS:
    <website>     Target website.
    <login>       Username or email address.
    <password>    Master password used for fingerprint and password generation.

EXAMPLES:
    Generate a password:
      lesspass example.org contact@example.org password

    Generate the fingerprint of a master password:
      lesspass password

    Generate a 32-characters password using SHA-512:
      echo password | lesspass example.org contact@example.org --sha512 -l 32

    Generate the entropy of a password, using 10,000 iterations:
      lesspass example.org contact@example.org password -i 10000 -E > entropy.txt

    Generate an alphanumeric password using the previously saved entropy:
      cat entropy.txt | lesspass -S

    The two previous examples are equivalent to:
      lesspass example.org contact@example.org password -i 10000 -S

基准测试

尽管Python实现使用hashlib作为后台,因此速度相当快,但Rust实现仍设法将执行速度提高了两倍以上。

比较Python和Rust应用程序的性能并不十分相关,但它至少可以说明此实现应该满足您的需求。

lesspass-cli

$ lesspass example.org [email protected] password -L 32
139 ms

lesspass.rs

$ lesspass example.org [email protected] password -l 32
64 ms

依赖项

~4MB
~68K SLoC