EronHennessey / grand

Generate random strings of characters and GUIDs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grand - generate random characters

Usage: grand [-switches] [length]

Switches:

-a include alphabetic characters
-n include numeric characters
-s include symbol characters
-x generate hexadecimal characters
-g generate a GUID
-h | -? print this help

If no arguments are specified, '-an 8' is assumed, which will generate a random 8-character alphanumeric string.

You can use it to generate passwords:

$ grand -ans 10
Ppzx4w~fdU

or GUIDs:

$ grand -g
83010e18-8a3a-57b0-33f7-b3235c67ce6b

or whatever you like...

Building it:

Build it by running make in the grand directory (substitute my example location with the one in which you've placed the source):

$ cd ~/src/grand
$ make
cc -std=c99 -o grand grand.c

Of course, you'll need make, and a C99 compiler to do so. GCC works well. ;)

If you don't have make, simply use the final line of the above output as your command:

$ cc -std=c99 -o grand grand.c

Installing it:

Install it by moving it to a directory in your PATH. For example:

$ mv grand ~/bin

Notes regarding usage:

  • Switches can be combined. For example, '-ans' specifies alpha + numeric + symbols.

  • Any argument without a '-' character is assumed to be the output length.

  • If '-x' is specified, any other character types (-a,-n,-s) are ignored.

  • If '-g' is specified, all other arguments are ignored.

  • GUIDs are always printed in lower-case. Don't whine, convert it to upper-case if you wish.

About

Generate random strings of characters and GUIDs

License:BSD 2-Clause "Simplified" License


Languages

Language:C 97.5%Language:Makefile 2.5%