.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Simple 3" .TH Simple 3 2023-07-25 "perl v5.38.0" "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::Simple \- encrypt stuff simply .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Crypt::Simple; \& \& my $data = encrypt(@stuff); \& \& my @same_stuff = decrypt($data); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Maybe you have a web application and you need to store some session data at the client side (in a cookie or hidden form fields) but you don't want the user to be able to mess with the data. Maybe you want to save secret information to a text file. Maybe you have better ideas of what to do with encrypted stuff! .PP This little module will convert all your data into nice base64 text that you can save in a text file, send in an email, store in a cookie or web page, or bounce around the Net. The data you encrypt can be as simple or as complicated as you like. .SH KEY .IX Header "KEY" If you don't pass any options when using \f(CW\*(C`Crypt::Simple\*(C'\fR we will generate a key for you based on the name of your module that uses this one. In many cases this works fine, but you may want more control over the key. Here's how: .IP "use Crypt::Simple passphrase => 'pass phrase';" 4 .IX Item "use Crypt::Simple passphrase => 'pass phrase';" The MD5 hash of the text string "pass phrase" is used as the key. .IP "use Crypt::Simple prompt => 'Please type the magic words';" 4 .IX Item "use Crypt::Simple prompt => 'Please type the magic words';" The user is prompted to enter a passphrase, and the MD5 hash of the entered text is used as the key. .IP "use Crypt::Simple passfile => '/home/marty/secret';" 4 .IX Item "use Crypt::Simple passfile => '/home/marty/secret';" The contents of the file /home/marty/secret are used as the pass phrase: the MD5 hash of the file is used as the key. .IP "use Crypt::Simple file => '/home/marty/noise';" 4 .IX Item "use Crypt::Simple file => '/home/marty/noise';" The contents of the file /home/marty/noise are directly used as the key. .SH INTERNALS .IX Header "INTERNALS" \&\f(CW\*(C`Crypt::Simple\*(C'\fR is really just a wrapper round a few other useful Perl modules: you may want to read the documentation for these modules too. .PP We use \f(CW\*(C`FreezeThaw\*(C'\fR to squish all your data into a concise textual representation. We use \f(CW\*(C`Compress::Zlib\*(C'\fR to compress this string, and then use \&\f(CW\*(C`Crypt::Blowfish\*(C'\fR in a home-brew CBC mode to perform the encryption. Somewhere in this process we also add a MD5 digest (using \f(CW\*(C`Digest::MD5\*(C'\fR). Then we throw the whole thing through \f(CW\*(C`MIME::Base64\*(C'\fR to produce a nice bit of text for you to play with. .PP Decryption, obviously, is the reverse of this process. .SH WARNING .IX Header "WARNING" Governments throughout the world do not like encryption because it makes it difficult for them to look at all your stuff. Each country has a different policy designed to stop you using encryption: some governments are honest enough to make it illegal; some think it is a dangerous weapon; some insist that you are free to encrypt, but only evil people would want to; some make confusing and contradictory laws because they try to do all of the above. .PP Although this modules itself does not include any encryption code, it does use another module that contains encryption code, and this documentation mentions encryption. Downloading, using, or reading this modules could be illegal where you live. .SH AUTHOR .IX Header "AUTHOR" Marty Pauley .SH COPYRIGHT .IX Header "COPYRIGHT" .Vb 1 \& Copyright (C) 2001 Kasei Limited \& \& This program is free software; you can redistribute it and/or modify it under \& the terms of the GNU General Public License; either version 2 of the License, \& or (at your option) any later version. \& \& This program is distributed in the hope that it will be useful, but WITHOUT \& ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS \& FOR A PARTICULAR PURPOSE. .Ve