String::MkPasswd(3pm)

πŸ“¦
version 0.05 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– String::MkPasswd πŸ’–

okay so bestie, this is the String::MkPasswd page from the User Contributed Perl Documentation set β€” it's the manual for a lil Perl library that makes random passwords for you, and honestly? she ate. ✨


🌸 NAME 🌸

String::MkPasswd β€” random password generator πŸŽ€


✨ SYNOPSIS ✨

use String::MkPasswd qw(mkpasswd);

print mkpasswd();

# for the masochisticly paranoid...
print mkpasswd(
    -length     => 27,
    -minnum     => 5,
    -minlower   => 1,   # minlower is increased if necessary
    -minupper   => 5,
    -minspecial => 5,
    -distribute => 1,
);

like look at her. one function. zero drama. πŸ’…


πŸ¦‹ ABSTRACT πŸ¦‹

This Perl library defines a single function, mkpasswd(), and its whole entire job is generating random passwords. It's meant to be the easy lil way for developers and sysadmins to whip up a password that's relatively secure without overthinking it. no cap. 🫢


πŸ‘‘ DESCRIPTION πŸ‘‘

The exportable mkpasswd() function returns a single scalar: a random password. πŸ’–

By default, that password is nine characters long, with a random distribution of four lower-case characters, two upper-case characters, two digits, and one non-alphanumeric character. literally the blueprint. 🌈

All of those parameters can be tuned by you, bestie β€” the deets are in the ARGUMENTS section below. πŸ‘‡

πŸŽ€ ARGUMENTS πŸŽ€

The mkpasswd() function takes an optional hash of arguments. (yes, optional. she's chill like that.)

  • -length β€” the total length of the password. the default is 9.
  • -minnum β€” the minimum number of digits that will appear in the final password. the default is 2.
  • -minlower β€” the minimum number of lower-case characters that will appear in the final password. the default is 2.
  • -minupper β€” the minimum number of upper-case characters that will appear in the final password. the default is 2.
  • -minspecial β€” the minimum number of non-alphanumeric characters that will appear in the final password. the default is 1.
  • -distribute β€” if you set this to a true value, the password characters get distributed between the left- and right-hand sides of the keyboard. this makes it harder for an onlooker to read your password while you're typing it (sneaky-vision protection, we love her for it πŸ‘€). the default is false.
  • -noambiguous β€” if you set this to a true value, the password characters won't include any that might be mistaken for others. this is particularly helpful if you're distributing a printed list of passwords to a group of people. the default is false.
  • -fatal β€” if you set this to a true value, mkpasswd() will Carp::croak() rather than return undef on error. the default is false.
⚠️ okay important math class moment: if -minnum, -minlower, -minupper, and -minspecial do not add up to -length, then -minlower will be increased to compensate. BUT if -minnum, -minlower, -minupper, and -minspecial add up to more than -length, then mkpasswd() will return undef. if you wanna change that behavior, go read the EXCEPTION HANDLING section rn. πŸ”₯

πŸ’œ EXCEPTION HANDLING πŸ’œ

By default, mkpasswd() will return undef if it cannot generate a password. some people are just ~inclined to exception handling~, so String::MkPasswd does its best to accommodate them. πŸ₯Ί

If the variable $String::MkPasswd::FATAL is set to a true value, mkpasswd() will Carp::croak() with an error instead of returning undef. boom. drama mode activated. πŸ’€

πŸ“ EXPORT πŸ“

None by default. The mkpasswd() method is exportable. (you gotta ask for her by name, she doesn't just show up uninvited. main character boundaries. πŸ’…)


🌟 SEE ALSO 🌟


🧚 AKNOWLEDGEMENTS 🧚

Don Libes of the National Institute of Standards and Technology, who wrote the Expect example, mkpasswd(1). absolute legend. thank you for your service. πŸ«‘πŸ’–


πŸ’ AUTHOR πŸ’

Chris Grau <cgrau@cpan.org>


Copyright (C) 2003-2012 by Chris Grau

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.


and that's the whole page bestie, mwah πŸ’‹ β€” this was perl v5.36.0, dated 2022-10-22, and it's the String::MkPasswd(3pm) manual. go forth and generate slay passwords. πŸ”βœ¨πŸ‘‘

πŸ“¦ where this page comes from