NAME
Algorithm::KeyGen -
SYNOPSIS
EXPORTS
Nothing exported by default
DEPENDENCIES
This module requires these other modules and libraries:
Perl::Module
Perl::Options
DESCRIPTION
EXAMPLES
This example will not abort:
use Algorithm::KeyGen qw($KeyGen);
for (1 .. 100) {
die unless $KeyGen->validate($KeyGen->create());
}
PUBLIC INTERFACE
new
- Create a new key generator
-
parameters:
$key_length Total length for the key. This is the string length when C<-char_width> is 1 (normal behavior). The default is 12. \@charset Characters (sequences) to use for the key. The default is [0 .. 9]. $charset Characters to use for the key in regex style, for example the default would be '0-9'. Can denote any characters where ord($char) < 126.
options:
-char_width => $n Width of each item in the character set. Used if you would like to use double-wide sequences such as ['aa', 'bb', 'cc']. The default is 1.
Relationships between source digits and key length.
T = Total key length (C<$key_length>) n = Number of random source digits T = n + n/2 2T = 3n 2T/3 = n
Possible values for T (
$key_length
):T = 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- n = 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32
This example will not abort:
# Create a new KeyGen use Algorithm::KeyGen; Algorithm::KeyGen->new(9, 'MyCharset');
rand
create
validate
hash
AUTHORS
Ryan Gies <ryangies@cpan.org>
COPYRIGHT
Copyright (C) 2014-2016 by Ryan Gies. All rights reserved.
Copyright (C) 2006-2013 by Livesite Networks, LLC. All rights reserved.
Copyright (C) 2000-2005 by Ryan Gies. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
* Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
* The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
To the best of our knowledge, no patented algorithms have been used. However, we
do not have the resources to carry out a patent search, and therefore cannot
give any guarantee of the above statement.