Data::Password::zxcvbn::TimeEstimate(3pm) | User Contributed Perl Documentation | Data::Password::zxcvbn::TimeEstimate(3pm) |
Data::Password::zxcvbn::TimeEstimate - functions to estimate cracking times
version 1.1.2
use Data::Password::zxcvbn::TimeEstimate qw(estimate_attack_times); my $estimates = estimate_attack_times($number_of_guesses);
This module provides functions for back-of-the-envelope crack time estimations, in seconds, based on a few scenarios.
my $estimates = estimate_attack_times($number_of_guesses);
Returns a hashref with two keys:
hashref of back-of-the-envelope crack time estimations, in seconds, based on a few scenarios:
online attack on a service that rate-limits authentication attempts
online attack on a service that doesn't rate-limit, or where an attacker has outsmarted rate-limiting.
offline attack. assumes multiple attackers, proper user-unique salting, and a slow hash function with moderate work factor, such as bcrypt, scrypt, PBKDF2.
offline attack with user-unique salting but a fast hash function like SHA-1, SHA-256 or MD5. A wide range of reasonable numbers anywhere from one billion - one trillion guesses per second, depending on number of cores and machines; ball-parking at 10B/sec.
same keys as "crack_times_seconds", but more useful for display: the values are arrayrefs "["english string",$value]" that can be passed to I18N libraries like "Locale::Maketext" to get localised versions with proper plurals
my $score = guesses_to_score($number_of_guesses);
Returns an integer from 0-4 (useful for implementing a strength bar):
too guessable: risky password. ("guesses < 10e3")
very guessable: protection from throttled online attacks. ("guesses < 10e6")
somewhat guessable: protection from un-throttled online attacks. ("guesses < 10e8")
safely un-guessable: moderate protection from offline slow-hash scenario. ("guesses < 10e10")
very un-guessable: strong protection from offline slow-hash scenario. ("guesses >= 10e10")
my ($string,@values) = @{ display_time($time) }; print My::Localise->get_handle->maketext($string,@values);
Given a $time in seconds, returns an arrayref suitable for "Locale::Maketext", like:
[ 'quant,_1,day', 23 ]
Gianni Ceccarelli <gianni.ceccarelli@broadbean.com>
This software is copyright (c) 2022 by BroadBean UK, a CareerBuilder Company.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
2023-04-04 | perl v5.36.0 |