Simple(3pm)

πŸ“¦
version 0.06 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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/secret are 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/noise are 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 FreezeThaw to squish all your data into a concise textual representation.
  • we use Compress::Zlib to compress that string.
  • then we use Crypt::Blowfish in 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::Base64 to 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 (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 πŸ˜­πŸ‘‘βœ¨