NAME

Crypt::Skip32::XS - Drop-in replacement for Crypt::Skip32

SYNOPSIS

use Crypt::Skip32::XS;

$cipher     = Crypt::Skip32::XS->new($key);
$ciphertext = $cipher->encrypt($plaintext);
$plaintext  = $cipher->decrypt($ciphertext);

DESCRIPTION

The Crypt::Skip32::XS module is similar in function to Crypt::Skip32, but is substantially faster as it is written in C/XS instead of pure Perl.

NOTE: As of version 0.10, Crypt::Skip32 automatically uses this module if it is installed.

METHODS

new
$cipher = Crypt::Skip32::XS->new($key);

Creates a new Crypt::Skip32::XS cipher object with the given key. The key must be 10 bytes long.

encrypt
$ciphertext = $cipher->encrypt($plaintext);

Encrypts plaintext and returns the ciphertext. The plaintext must be of 4 bytes long.

decrypt
$plaintext = $cipher->decrypt($ciphertext);

Decrypts ciphertext and returns the plaintext. The ciphertext must be 4 bytes long.

blocksize
$blocksize = $cipher->blocksize;
$blocksize = Crypt::Skip32::XS->blocksize;

Returns the size (in bytes) of the block cipher, which is always 4.

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

Returns the size (in bytes) of the key, which is always 10.

PERFORMANCE

This distribution contains a benchmarking script which compares Crypt::Skip32::XS with Crypt::Skip32. These are the results on a MacBook 2GHz with Perl 5.8.8:

Benchmark: running perl, xs for at least 1 CPU seconds...
      perl:  1 wallclock secs ( 1.07 usr +  0.01 sys =  1.08 CPU) @ 3555.56/s (n=3840)
        xs:  1 wallclock secs ( 1.08 usr +  0.01 sys =  1.09 CPU) @ 263044.95/s (n=286719)
         Rate  perl    xs
perl   3542/s    --  -99%
xs   263474/s 7339%    --

SEE ALSO

Crypt::Skip32

http://en.wikipedia.org/wiki/Skipjack_(cipher)

REQUESTS AND BUGS

Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Crypt-Skip32-XS. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Crypt::Skip32::XS

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright (C) 2008-2009 gray <gray at cpan.org>, all rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

gray, <gray at cpan.org>