maikay/maihash

simple tool to generate a random hash

1.0.0 2014-07-03 18:10 UTC

This package is not auto-updated.

Last update: 2020-07-06 06:24:21 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

simple tool to generate a random hash

Installation

To install MaiHash put the following snippet to your composer.json:

{
    "require": {
        "maikay/maihash": "1.0.0"
    }
}

Options

option description default
min min length of generated hash 5
max max length of generated hash 10
char haystack of all used chars abcdefghijklmnopqrstuvwxyz[*]

[*] abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890

Examples

Just have a look at the examples

$generator = new \MaiHash\Generator();

Example #1 - invokable

$invokeOutput = $generator(
    array(
        'min'   => 5,
        'max'   => 10,
        'chars' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
    )
);
var_dump($invokeOutput);

/* output */
string '75SORZ2L6I' (length=10)

Example #2 - method call

$methodOutput = $generator->getHash(
    array(
        'min'   => 10,
        'max'   => 15,
        'chars' => 'abcdefghijklmnopqrstuvwxyz1234567890',
    )
);
var_dump($methodOutput);

/* output */
string '8o8p6wz3hu325h1' (length=15)