Password strength and Sqids
Estimate how hard a password is to guess, with a score and advice, and turn lists of integers into short ids and back with Sqids. Typical uses: refuse weak passwords at sign up, show short ids in URLs instead of database keys.
string password_strengthstring password_strengthstring sqids_encodestring sqids_encodestring sqids_decodestring sqids_decode

string password_strength <password>


Description

    Estimate the strength of a password: JSON {score (0 to 4), guesses, guesses_log10, length, classes, reasons, crack_time_seconds: {online_throttled_100_per_hour, online_10_per_second, offline_slow_hash_10k_per_second, offline_fast_hash_10g_per_second}, sequence: [{pattern, start, length, guesses...}], method}

Parameters

    password:   The password (4096 characters at most) - String - required
admin
string password_strength "azerty123"
mentdb
{"score": 1, "guesses": 15000, "guesses_log10": 4.176, "length": 9, "classes": ["lower", "digit"], "reasons": ["contains a common word", "sequence like abc or 6543"], "crack_time_seconds": {"online_throttled_100_per_hour": 540000, "online_10_per_second": 1500, "offline_slow_hash_10k_per_second": 2, "offline_fast_hash_10g_per_second": 0}, "sequence": [{"pattern": "dictionary", "start": 0, "length": 6, "guesses": 50, "dictionary": "french", "rank": 1, "reversed": false, "l33t": false}, {"pattern": "sequence", "start": 6, "length": 3, "guesses": 50, "ascending": true}], "method": "heuristic in the style of zxcvbn: an estimate, not a guarantee"}
A date and a l33t word
admin
string password_strength "P@ssword1985"
mentdb
{"score": 1, "guesses": 15000, "guesses_log10": 4.176, "length": 12, "classes": ["lower", "upper", "digit", "symbol"], "reasons": ["one of the 100 most common passwords", "l33t substitutions (@ for a, 0 for o...) are well known", "a capital at the start or the end does not help much", "recent year"], "crack_time_seconds": {"online_throttled_100_per_hour": 540000, "online_10_per_second": 1500, "offline_slow_hash_10k_per_second": 2, "offline_fast_hash_10g_per_second": 0}, "sequence": [{"pattern": "dictionary", "start": 0, "length": 8, "guesses": 50, "dictionary": "passwords", "rank": 2, "reversed": false, "l33t": true}, {"pattern": "regex", "start": 8, "length": 4, "guesses": 50}], "method": "heuristic in the style of zxcvbn: an estimate, not a guarantee"}
Four random words
admin
string password_strength "cheval-agrafe-pile-correct"
mentdb
{"score": 4, "guesses": 6.3612E18, "guesses_log10": 18.804, "length": 26, "classes": ["lower", "symbol"], "reasons": ["contains a common word"], "crack_time_seconds": {"online_throttled_100_per_hour": 2.29E20, "online_10_per_second": 6.3612E17, "offline_slow_hash_10k_per_second": 636120000010000, "offline_fast_hash_10g_per_second": 636120000}, "sequence": [{"pattern": "dictionary", "start": 0, "length": 6, "guesses": 93, "dictionary": "french", "rank": 93, "reversed": false, "l33t": false}, {"pattern": "bruteforce", "start": 6, "length": 13, "guesses": 10000000000000}, {"pattern": "dictionary", "start": 19, "length": 7, "guesses": 1140, "dictionary": "us_tv_and_film", "rank": 1140, "reversed": false, "l33t": false}], "method": "heuristic in the style of zxcvbn: an estimate, not a guarantee"}

string password_strength <password> <json_params>


Description

    Estimate the strength with parameters: user_inputs (words of the user: name, e-mail, site... counted as known words), min_length (8: only for the reason too short)

Parameters

    password:   The password - String - required
    json_params:   The parameters, as a JSON object - String - required
admin
string password_strength "Dupont2024!" "{\"user_inputs\": [\"jean\", \"dupont\", \"jean.dupont@example.com\"], \"min_length\": 12}"
mentdb
{"score": 2, "guesses": 10010000, "guesses_log10": 7, "length": 11, "classes": ["lower", "upper", "digit", "symbol"], "reasons": ["too short: 11 characters, 12 at least", "contains a personal word (user_inputs)", "a capital at the start or the end does not help much"], "crack_time_seconds": {"online_throttled_100_per_hour": 360360000, "online_10_per_second": 1001000, "offline_slow_hash_10k_per_second": 1001, "offline_fast_hash_10g_per_second": 0.001}, "sequence": [{"pattern": "dictionary", "start": 0, "length": 6, "guesses": 50, "dictionary": "user_inputs", "rank": 2, "reversed": false, "l33t": false}, {"pattern": "bruteforce", "start": 6, "length": 5, "guesses": 100000}], "method": "heuristic in the style of zxcvbn: an estimate, not a guarantee"}
Used in use cases (1 recipe)

    Web & API developer › Clean a user comment before showing it, check a sign-up password and make a short link
Often used with

    html sanitize  ·  string sqids_decode  ·  string sqids_encode

string sqids_encode <json_numbers>


Description

    A short id from a JSON array of integers from 0 to 9223372036854775807 (or one integer); [] gives an empty text

Parameters

    json_numbers:   The numbers - String - required
admin
string sqids_encode "[1, 2, 3]"
mentdb
86Rf07
One number
admin
string sqids_encode "4512"
mentdb
Sm2C

string sqids_encode <json_numbers> <json_params>


Description

    A short id with parameters: alphabet (3 printable ASCII characters at least, each once), min_length (0 to 255), blocklist (words the id must not contain; replaces the default list, [] for none)

Parameters

    json_numbers:   The numbers - String - required
    json_params:   The parameters, as a JSON object - String - required
admin
string sqids_encode "[4512]" "{\"alphabet\": \"k3G7QAe51FCsPW92uEOyq4Bg6Sp8YzVTmnU0liwDdHXLajZrfxNhobJIRcMvKt\", \"min_length\": 8}"
mentdb
gCBzqXOC
Used in use cases (1 recipe)

    Web & API developer › Clean a user comment before showing it, check a sign-up password and make a short link
Often used with

    html sanitize  ·  string password_strength  ·  string sqids_decode

string sqids_decode <id>


Description

    The numbers of a short id: a JSON array; [] when the id has a character outside the alphabet

Parameters

    id:   The id - String - required
admin
string sqids_decode "86Rf07"
mentdb
[1, 2, 3]

string sqids_decode <id> <json_params>


Description

    The numbers of a short id with parameters: alphabet, min_length, blocklist (as for the encoding), strict (false: true gives [] for an id that string sqids_encode would not make, as several ids decode to the same numbers)

Parameters

    id:   The id - String - required
    json_params:   The parameters, as a JSON object - String - required
admin
string sqids_decode "gCBzqXOC" "{\"alphabet\": \"k3G7QAe51FCsPW92uEOyq4Bg6Sp8YzVTmnU0liwDdHXLajZrfxNhobJIRcMvKt\", \"min_length\": 8}"
mentdb
[4512]
Another spelling of [4572721] is refused by strict
admin
string sqids_decode "aho1e" "{\"strict\": true}"
mentdb
[]
Used in use cases (1 recipe)

    Web & API developer › Clean a user comment before showing it, check a sign-up password and make a short link
Often used with

    html sanitize  ·  string password_strength  ·  string sqids_encode