NAME
Tea.pm - The Tiny Encryption Algorithm in Perl and JavaScript
SYNOPSIS
Usage:
use Crypt::Tea;
$key = 'PUFgob$*LKDF D)(F IDD&P?/';
$ascii_ciphertext = &encrypt ($plaintext, $key);
...
$plaintext_again = &decrypt ($ascii_ciphertext, $key);
...
$signature = &asciidigest ($text);
In CGI scripts:
use Crypt::Tea;
print &tea_in_javascript; # now the browser can encrypt
# and decrypt ! see CGI::Htauth.pm for examples ...
DESCRIPTION
This module implements TEA, the Tiny Encryption Algorithm, and some Modes of Use, in Perl and JavaScript.
The $key is a sufficiently longish string; at least 17 random 8-bit bytes for single encryption.
As of version 1.34, various Htauth-specific hook routines have now been moved out into the CGI::Htauth.pm module.
Version 1.44, #COMMENT#
(c) Peter J Billam 1998
SUBROUTINES
- encrypt( $plaintext, $key );
-
Encrypts with CBC (Cipher Block Chaining)
- decrypt( $ciphertext, $key );
-
Decrypts with CBC (Cipher Block Chaining)
- binary2ascii( $a_binary_string );
-
Provide an ascii text encoding of the binary argument. If Tea.pm is not being invoked from a GCI script, the ascii is split into lines of 72 characters.
- ascii2binary( $an_ascii_string );
- asciidigest( $a_string );
-
Returns an asciified binary signature of the argument.
- tea_in_javascript();
-
Returns a compatible implementation of TEA in JavaScript, for use in CGI scripts to communicate with browsers.
AUTHOR
Peter J Billam <peter@pjb.com.au>, with thanks also to Neil Watkiss for MakeMaker packaging.
CREDITS
Based on TEA, as described in http://www.cl.cam.ac.uk/ftp/papers/djw-rmn/djw-rmn-tea.html , and on some help from Applied Cryptography by Bruce Schneier as regards the modes of use.
SEE ALSO
http://www.pjb.com.au/, CGI::Htauth.pm, perl(1).