Crypt::Skip32::Base64URLSafe - Create URL-safe encodings of 32-bit values
use Crypt::Skip32::Base64URLSafe; my $key = pack( 'H20', "112233445566778899AA" ); # Always 10 bytes! my $cipher = Crypt::Skip32::Base64URLSafe->new($key); my $b64 = $cipher->encrypt_number_b64_urlsafe(3493209676); # baJxAA my $number = $cipher->decrypt_number_b64_urlsafe('baJxAA'); # 493209676
This module melds together Crypt::Skip32 and MIME::Base64::URLSafe.
Crypt::Skip32 is a 80-bit key, 32-bit block cipher based on Skipjack. One example where Crypt::Skip32 has been useful: You have numeric database record ids which increment sequentially. You would like to use them in URLs, but you don't want to make it obvious how many X's you have in the database by putting the ids directly in the URLs.
MIME::Base64::URLSafe creates a URL-safe Base64 version of a string.
Putting the two together lets you have numeric database records ids which you can use safely in URLs without letting users see how many records you have or letting them jump forward or backwards between records.
You should pick a different key to the one in the synopsis. It should be 10 bytes.
Leon Brocard <acme@astray.com>.
Copyright (C) 2008, Leon Brocard
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
To install Crypt::Skip32::Base64URLSafe, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::Skip32::Base64URLSafe
CPAN shell
perl -MCPAN -e shell install Crypt::Skip32::Base64URLSafe
For more information on module installation, please visit the detailed CPAN module installation guide.