.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "CAST5 3pm" .TH CAST5 3pm "2012-02-10" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Crypt::CAST5 \- CAST5 block cipher .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Crypt::CBC; \& \& my $crypt = Crypt::CBC\->new({ \& key => "secret key", \& cipher => "CAST5", \& }); \& \& my $message = "All mimsy were the borogoves"; \& my $ciphertext = $crypt\->encrypt($message); \& print unpack("H*", $ciphertext), "\en"; \& \& my $plaintext = $crypt\->decrypt($ciphertext); \& print $plaintext, "\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides an implementation of the \s-1CAST5\s0 block cipher using compiled C code for increased speed. \s-1CAST5\s0 is also known as \s-1CAST\-128.\s0 It is a product of the \s-1CAST\s0 design procedure developed by C. Adams and S. Tavares. .PP The \s-1CAST5\s0 cipher is available royalty-free. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "blocksize" .IX Subsection "blocksize" Returns the \s-1CAST5\s0 block size, which is 8 bytes. This function exists so that Crypt::CAST5 can work with Crypt::CBC. .SS "keysize" .IX Subsection "keysize" Returns the maximum \s-1CAST5\s0 key size, 16 bytes. .SS "new" .IX Subsection "new" .Vb 1 \& $cast5 = Crypt::CAST5\->new($key); .Ve .PP Create a new encryption object. If the optional key parameter is given, it will be passed to the \fIinit()\fR function. .SS "init" .IX Subsection "init" .Vb 1 \& $cast5\->init($key); .Ve .PP Set or change the encryption key to be used. The key must be from 40 bits (5 bytes) to 128 bits (16 bytes) in length. Note that if the key used is 80 bits or less, encryption and decryption will be somewhat faster. .PP It is best for the key to be random binary data, not something printable like a password. A message digest function may be useful for converting a password to an encryption key; see Digest::SHA1 or Digest::MD5. Note that Crypt::CBC runs the given \*(L"key\*(R" through \s-1MD5\s0 to get the actual encryption key. .SS "encrypt" .IX Subsection "encrypt" .Vb 1 \& $ciphertext = $cast5\->encrypt($plaintext); .Ve .PP Encrypt a block of plaintext using the current encryption key, and return the corresponding ciphertext. The input must be 8 bytes long, and the output has the same length. Note that the encryption is in \s-1ECB\s0 mode, which means that it encrypts each block independently. That can leave you vulnerable to dictionary attacks, so it is generally best to use some form of chaining between blocks; see Crypt::CBC. .SS "decrypt" .IX Subsection "decrypt" .Vb 1 \& $plaintext = $cast5\->decrypt($ciphertext); .Ve .PP Decrypt the ciphertext and return the corresponding plaintext. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1RFC 2144, \s0\*(L"The \s-1CAST\-128\s0 Encryption Algorithm\*(R", C. Adams, May 1997 .PP Crypt::CBC .SH "AUTHOR" .IX Header "AUTHOR" Bob Mathews, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2002\-2006 Bob Mathews .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.