Crypt-Skip32

 view release on metacpan or  search on metacpan

lib/Crypt/Skip32.pm  view on Meta::CPAN

=item keysize

  my $keysize = $cipher->keysize;
  my $keysize = Crypt::Skip32->keysize;

Returns the size (in bytes) of the key.  This is always 10 bytes (for
80 bits).

=back

=head1 NOTES

If L<Crypt::Skip32::XS> is installed, this module will use it and the
constructor will return an object of that type, though the interface is
identical.  You can stick with the pure Perl version by setting the
CRYPT_SKIP32_PP environment variable before using this module.

If reporting a bug, please try to determine (if possible) if it is this module
or the XS one, and report it to the corresponding maintainer.

=head1 EXAMPLE

This sample code demonstrates how Crypt::Skip32 can be used to encrypt
unsigned integers and encode them for use in web URLs, form values,
and other places where short encrypted text might be useful.

  use Crypt::Skip32;

  # Create a cipher. Change the long hex string to your secret key.
  my $key         = pack("H20", "112233445566778899AA");
  my $cipher      = new Crypt::Skip32 $key; # Always 10 bytes!

  # Encrypt an unsigned integer (under 2^32) into an 8-digit hex string.
  my $number      = 3493209676;
  my $plaintext   = pack("N", $number);
  my $ciphertext  = $cipher->encrypt($plaintext); # Always 4 bytes!
  my $cipherhex   = unpack("H8", $ciphertext);
  print "$number encrypted and converted to hex: $cipherhex\n";

  # Decrypt an encrypted, hexified unsigned integer.
  my $ciphertext2 = pack("H8", $cipherhex);
  my $plaintext2  = $cipher->decrypt($ciphertext2); # Always 4 bytes!
  my $number2     = unpack("N", $plaintext2);
  print "$cipherhex converted back and decrypted: $number2\n";

The above code generates the output:

  3493209676 encrypted and converted to hex: 6da27100
  6da27100 converted back and decrypted: 3493209676

=head1 CAVEATS

This initial alpha Perl implementation of Crypt::Skip32 has not been
extentively reviewed by cryptographic experts, nor has it been tested
extensively on many different platforms.  It is recommended that this
code not be used for applications which require a high level of
security.

Reviewers and testers welcomed.

Though this module has been coded to follow a Crypt::CBC usable
interface, it is not intended for use in encrypting long chunks of
text.  For those purposes, it is suggested you use another high
quality, proven cipher with a longer block size.

=head1 INSTALLATION

If your Linux distro does not have a prepared package for this module,
then the preferred method for installation is directly from the CPAN
using a command like:

    sudo cpan Crypt::Skip32

=head1 SOURCE

The source for this module is being maintained on github:

    https://github.com/alestic/Crypt-Skip32

Forks and patches will be reviewed, but please be aware that the
targeted functionality of this particular module is very narrow.

Feel free to build other abstractions on top of this module if you
want to make it easier to use or to create a particular application
for its use.

=head1 BUGS

Problems and feature requests can be submitted through the github
"issues" link:

    https://github.com/alestic/Crypt-Skip32/issues

A gentle reminder sent directly to the author (below) may also help
increase awareness and attention.

=head1 SEE ALSO

The original SKIP32 implementation in C by Greg Rose:
http://www.qualcomm.com.au/PublicationsDocs/skip32.c

The 80-bit key, 64-bit block Skipjack cipher created by the NSA (Perl
code maintained by Julius C. Duque): B<Crypt::Skipjack>

B<Crypt::Skip32::XS>

=head1 AUTHOR

Perl code maintained by Eric Hammond
E<lt>eric-cpan-2@thinksome.comE<gt>
http://www.anvilon.com

Original SKIP32 C code written 1999-04-27 by Greg Rose, based on an
implementation of the Skipjack algorithm written by Panu Rissanen.

=head1 CREDITS

The following have contributed to the Perl version:

    John Laur
    Joe Edmonds



( run in 0.497 second using v1.01-cache-2.11-cpan-e1769b4cff6 )