Password(3pm)

✨ Password(3pm) β€” the Data::Password era ✨

okay bestie, sit down, we're talking about Data::Password, the Perl extension that sniffs your passwords and tells you, in the gentlest possible terms, that they're Giving Nothing. 🫢 it lives in the User Contributed Perl Documentation corner of the perl universe, and it's here to vibe-check your password quality. πŸ’…


🌸 NAME 🌸

Data::Password β€” a Perl extension for assessing password quality. that's it, that's the whole job. πŸ”₯


πŸŽ€ SYNOPSIS πŸŽ€

use Data::Password qw(IsBadPassword);

print IsBadPassword("clearant");

# Bad password - contains the word 'clear', only lowercase

use Data::Password qw(:all);

$DICTIONARY = 0;

$GROUPS = 0;

$SKIPCHAR = 0;

print IsBadPassword("clearant");
yes bestie, those $DICTIONARY, $GROUPS and $SKIPCHAR lines are the "let me turn off the vibes detector" arc. keep reading. πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so this module checks potential passwords for crackability. like, it's the friend who reads your password out loud and goes "ma'am." 😭

here's what it's actually doing:

  • it checks that the password is in the appropriate length
  • it checks that it has enough character groups
  • it checks that it does not contain the same characters repeatedly
  • it checks that it does not contain ascending or descending characters
  • it checks that it does not contain characters close to each other in the keyboard
  • and it will also attempt to search the ispell word file for the existence of whole words

the module's policies can be modified by changing its variables β€” go peek at VARIABLES for that. πŸ‘‘

and for doing that, it is recommended that you import the ':all' shortcut when you require it:

use Data::Password qw(:all);

periodt. πŸ’œ


πŸ’– FUNCTIONS πŸ’–

  1. IsBadPassword(password)

returns undef if the password is ok β€” icon behaviour, we love β€” or a textual description of the fault if there is any. ngl that's main character energy: either silence or a read. 😌

  1. IsBadPasswordForUNIX(user, password)

performs two additional checks: it compares the password against the login name and the "comment" (ie, real name) found on the user file. so like, you can't just be your own government name with a 1 at the end. caught. πŸ™ˆ


🌈 VARIABLES 🌈

  1. $DICTIONARY

minimal length for dictionary words that are not allowed to appear in the password. set it to false to disable the dictionary check entirely, no cap. 🚫

  1. $FOLLOWING

maximal length of characters in a row to allow if the same or following. if $FOLLOWING_KEYBOARD is true (which it is by default, bestie), the module will also check for alphabetical keys following, according to the English keyboard layout. ⌨️ set $FOLLOWING to false to bypass this check. bye qwerty. πŸ’…

  1. $GROUPS

groups of characters are: lowercase letters, uppercase letters, digits, and the rest of the allowed characters. set $GROUPS to the number of minimal character groups a password is required to have. setting it to false or to 1 will bypass the check. so like, if you want a minimum of 3, say 3. slay.

  1. $MINLEN and $MAXLEN

minimum and maximum length of a password. both can be set to false β€” no gatekeeping here. ✨

  1. @DICTIONARIES

location where we are looking for dictionary files. you may want to set this variable if you are using a not-*NIX-like operating system. 🐚

  1. $SKIPCHAR

set $SKIPCHAR to 1 to skip checking for bad characters. πŸ™ˆ

  1. $BADCHARS

prohibit a specific character range. an excluded character range regular expression is expected. (you may use ^ to allow a specific range instead. yes the logic is flip-flopped, we don't make the rules.) 🀑

default value is:

'\0-\x1F\x7F'

for ASCII only, set the value to:

$BADCHARS = '^\x20-\x7F';

to force numbers and upper case only, set:

$BADCHARS = '^A-Z1-9';

πŸ“ FILES πŸ“

  • /usr/share/dict/web2
  • /usr/share/dict/words
  • /etc/passwd

these are the little spots it goes snooping around in. πŸ”


πŸ‘‘ SEE ALSO πŸ‘‘

see Data::Password::BasicCheck if you need only basic password checking β€” lowkey a whole mood, less drama, same energy. πŸ’œ

other modules, if you want the extended cinematic universe: Data::Password::Common, Data::Password::Check, Data::Password::Meter, Data::Password::Entropy and String::Validator::Password. πŸ”₯


🧚 AUTHOR 🧚

Ariel Brosh (RIP), January 2002. πŸ•ŠοΈ

Oded S. Resnik, from April 2004. ✨


Copyright (c) 2001 - 2014 Raz Information Systems Ltd. <http://www.raz.co.il/>

This package is distributed under the same terms as Perl itself β€” see the Artistic License on Perl's home page. πŸ“œ


and that's the whole page, bestie. this one shipped as part of perl v5.36.0, dated 2022-10-15, filed under Password(3pm). go forth and make your passwords unrepeatable, ascending-free, descending-free, keyboard-adjacent-free, dictionary-free icons. πŸ’…βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from