Simple(3pm)
π Simple(3pm) β Crypt::Simple π
okay bestie, so this is Crypt::Simple from the Simple(3pm) manual, and it's literally the cutest little "encrypt my stuff pls" module you'll ever meet. let's get into it π«Ά
β¨ NAME β¨
Crypt::Simple β encrypt stuff simply
like. that's it. that's the whole pitch. so iconic of it honestly.
πΈ SYNOPSIS πΈ
use Crypt::Simple;
my $data = encrypt(@stuff);
my @same_stuff = decrypt($data);
see how chill that is?? you encrypt your stuff, you get back a string, you decrypt the string, you get your stuff back. no cap. β¨
π DESCRIPTION π
so like. maybe you have a web app and you need to keep session data on the client side (in a cookie, or in hidden form fields) but you do NOT want the user messing with it, bestie. absolutely not. maybe you wanna save secret info into a text file. maybe you have better ideas for what to do with encrypted stuff, idk, you're creative, i believe in you π
this little module will turn all your data into nice base64 text β so you can save it in a text file, send it in an email, stash it in a cookie or a web page, or bounce it around the Net like a little bouncy ball π and the data you encrypt can be as simple or as complicated as you want. literally anything. go off.
π KEY π
okay so here's the vibe: if you don't pass any options when you use Crypt::Simple, it'll generate a key for you based on the name of your module that uses this one. lowkey works fine in lots of cases. but maybe you want more control over the key, bestie?? valid. here's how:
use Crypt::Simple passphrase => 'pass phrase';
- the MD5 hash of the text string
"pass phrase"is used as the key.
use Crypt::Simple prompt => 'Please type the magic words';
- the user gets prompted to enter a passphrase, and the MD5 hash of whatever they typed in is used as the key.
use Crypt::Simple passfile => '/home/marty/secret';
- the contents of the file
/home/marty/secretare used as the pass phrase: the MD5 hash of the file is used as the key.
use Crypt::Simple file => '/home/marty/noise';
- the contents of the file
/home/marty/noiseare used directly as the key. no hashing, just raw file energy π₯
π§ INTERNALS π§
ngl, Crypt::Simple is really just a wrapper around a few other useful Perl modules, and you might wanna read their docs too, iykyk:
- we use
FreezeThawto squish all your data into a concise textual representation. - we use
Compress::Zlibto compress that string. - then we use
Crypt::Blowfishin a home-brew CBC mode to do the actual encryption. - somewhere in this process we also add an MD5 digest (using
Digest::MD5). - then we throw the whole thing through
MIME::Base64to produce a nice bit of text for you to play with β¨
decryption is, obviously, the reverse of this process. the way that it just... undoes itself. main character energy honestly π
β οΈ WARNING β οΈ
okay bestie this is the serious part, pay attention π¨
governments all over 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's a dangerous weapon; some insist that you're 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.
and although this module itself does not include any encryption code, it does use another module that contains encryption code, and this documentation mentions encryption. so like.
downloading, using, or reading this module could be illegal where you live. fr fr. check your local laws, bestie π
π¦ AUTHOR π¦
Marty Pauley <marty@kasei.com>
π COPYRIGHT π
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.
and that's the whole page, babe π this one's perl v5.36.0, dated 2022-12-07, and it lives in Simple(3pm) β so if you ever forget, just man 3pm Simple and i'll be right here. slay, stay encrypted, and don't let the governments get you ππβ¨
π¦ where this page comes from
- debian bookworm: libcrypt-simple-perl 0.06-8 Β· GPL-2.0-or-later
- debian trixie: libcrypt-simple-perl 0.06-8 Β· GPL-2.0-or-later
- ubuntu noble: libcrypt-simple-perl 0.06-8 Β· GPL-2.0-or-later
- ubuntu resolute: libcrypt-simple-perl 0.06-8 Β· GPL-2.0-or-later
- ubuntu stonking: libcrypt-simple-perl 0.06-8 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms