generate-password(3)
[Home]
[Commands]
[Variables]
[Macro-Dev]
[Glossary]
NAME
generate-password - Generate a password with given criteria
insert-password - Create and insert a new password string
password-to-phonic - Convert a password to phonic string
SYNOPSIS
n generate-password
n generate-password "flags"
generate-password "length" "flags"
n insert-password "length" "flags"
password-to-phonic "password"
DESCRIPTION
The password commands are typically used by a system administrator to generate new random passwords or to phonically unambiguously describe a password.
generate-password is a low level macro for setting the
$result(5) variable to a new password meeting the criteria defined by combinations of argument n and optionally passed arguments "length" and "flags".
If argument n is given then the lower byte (0x0ff) defines the password length, otherwise the "length" must be given. When a word base password is generated the length is the number of words, if a character based password is to be generated the length is the number of characters. The maximum length of the password is 255 bytes/words.
If the argument n is given and its value is greater than 255 then the bits above 255 are used to determine the flags, see list below. Otherwise the flags must get given and are defined as follows:
w
Generate a random word(s) based password, the given length is used to define the total number of letters to be used by one or more words selected randomly using the spelling dictionaries. If flag u is also given then the first or last letter of each word may randomly be turned to uppercase, if flag ! and/or b are given then each word will be separated by a 'special' character (see flags below) otherwise each word is separated by a '-' for clarity. Finally if flag d is given then a random two digit number is appended to the password. This can be specified by bit 0x0100 in argument n.
h
Generate a random password using hexadecimal characters, i.e. 0-9 and a-f. If the u flag is given then uppercase letters are used instead. No other flag apart from N can be used. This can be specified by bit 0x0200 in argument n.
d
The 10 digit characters, 0-9, are added to the character class used when not generating a word or hex based password. This can be specified by bit 0x0400 in argument n.
l
The 26 lowercase letters, a-z, are added to the character class used when not generating a word or hex based password. This can be specified by bit 0x0800 in argument n.
u
The 26 uppercase letters, A-Z, are added to the character class used when not generating a word or hex based password. This can be specified by bit 0x1000 in argument n.
!
24 'special' characters are added to the character class used when not generating a word or hex based password, these characters include !, $, % & ... but not brackets or white spaces. This can be specified by bit 0x2000 in argument n.
b
8 bracket characters ([, ], {, }, (, ), <, >) are added to the character class used when not generating a word or hex based password. This can be specified by bit 0x4000 in argument n.
s
The space character is added to the character class used when not generating a word or hex based password. This can be specified by bit 0x8000 in argument n.
e
When the e flag is given then at least one character from each of the main requested character classes, i.e. digits, lowercase letters, uppercase letters and specials, must be present in the generated password, if not another password is generated until it does. This can be specified by bit 0x10000 in argument n.
D
When generating a word based password and this flag is given the current spelling dictionary is used, when not given a fixed dictionary of 7776 English words is used. Caution should be used when using a general MicroEmacs dictionary as the words can be rude, hard to spell and have accents, the alternative password word list contains only relatively unambiguous, easy to spell non-expletive words. This can be specified by bit 0x20000 in argument n.
N
When given, flag N does not update the user's last or default password criteria, this flag can be used by macros to avoid affecting the user experience. This can be specified by bit 0x40000 in argument n.
insert-password uses generate-password to generates a new random password and insert it into the current buffer with the phonic form. The length and flags arguments are the same as generate-password, see above, however argument n can be used to modify the default behavior of the command, where the bits are defined as follows:
0x01
When set the user is prompted for the length and the flags, however when not set the default or last values will be reused.
0x02
When set the phonic form will not be inserted, however when not set a phonic form will be inserted in brackets after the password if the password is not word of hex based and contains something other than digits.
password-to-phonic converts a string of characters to the phonic alphabet, the command requires a single argument password which is converted to a phonic string. The command password-to-phonic "y5Ck" inserts the phonic string into the buffer:
yankee - Five - CHARLIE - kilo
NOTES
The password commands are macros defined in password.emf.
generate-password can be used to generate a large random number sequence by reducing the character class to just d, for example:
insert-password 30 "d"
Will insert a 30 digit random sequence. Similarly the h flag can be used instead to create a random byte sequence in hex format.
SEE ALSO
(c) Copyright JASSPA 2025
Last Modified: 2024/11/23
Generated On: 2025/09/29