I settled on:
# Individual registers as a new user, supplying a username
# and a password/passphrase in a form on a web page.
# But, for illustration:
my $desired_password = 'Owning 2 boats is 1 boat too many!';
my $csh = Crypt::SaltedHash->new(algorithm => 'SHA-256');
my $digest = $csh->generate; # Some might prefer to call 'digest'
# something like 'hash_string' instead
# Then the value of $digest is stored to a file or database
# along with the corresponding username (not shown).
# By the way, for the $desired_password shown, the digest that
# was generated is this string:
# ...but it would be very different for you, because Crypt::SaltedHash
# randomizes the "salt" used in the creation of the digest. And it
# would be very different for me, if this script were to be run a
# second time, even though it would be processing the same 'Owning 2
# boats is 1 boat too many!' desired password.
In another program, when the individual enters a username and a password/passphrase into a login form:
my $asserted_password = ___; # Some process to retrieve the value
# entered on a web form by the user, not illustrated here
my $digest = ___; # Some retrieval process that looks up the earlier-s
# digest corresponding to the username, not illustrated here
my $is_valid = Crypt::SaltedHash->validate( $digest, $asserted_passwor
grant_account_access() if ( $is_valid );