Hashids::Util - Shuffling and conversion functions for Hashids
use Hashids::Util qw( consistent_shuffle to_alphabet from_alphabet any bignum );
Hashids::Util provides utility functions for Hashids for consistent shuffling of alphabets, conversion of numbers to hash strings, and others. These are originally included as private functions, but are now provided here as a separate module as they can be general enough to be used in other code.
Hashids::Util
Hashids::Util does not export any functions by default.
my @shuffled_alphabet = consistent_shuffle( $alphabet, $salt );
Given an alphabet and salt, produce a shuffled alphabet. Both alphabet and salt can be either strings or arrayrefs of characters.
my $hash = to_alphabet( $num, $alphabet );
Produce a hash string given a number and alphabet. The given alphabet may be a string or an arrayref of characters.
my $num = from_alphabet( $hash, $alphabet );
Produce a number from the given hash string and alphabet. The given alphabet may be a string or arrayref of characters.
print "At least one non-negative value" any { $_ >= 0 } @list_of_numbers;
Returns a true value if any item in the given list meets the given criterion. Returns false otherwise. Adapted from List::MoreUtils::PP.
my $bignum = bignum( '1_152_921_504_606_846_976' );
Construct a Math::BigInt scalar from the given number.
Hashids
Zak B. Elep <zakame@cpan.org>
To install Hashids, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hashids
CPAN shell
perl -MCPAN -e shell install Hashids
For more information on module installation, please visit the detailed CPAN module installation guide.