HCE_SHA(3pm)

πŸ“¦
version 0.75 Β· 4 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– HCE_SHA(3pm) β€” Crypt::HCE_SHA, bestie edition πŸ’–

okay so HCE_SHA(3pm) is a User Contributed Perl Documentation page, and it's all about Crypt::HCE_SHA β€” a Perl extension that implements one way hash chaining encryption using SHA. yes that's a mouthful, no we're not scared of it. πŸ’…


✨ SYNOPSIS ✨

here's the whole vibe in code, literally:

use Crypt::HCE_SHA;

$hce_sha = Crypt::HCE_SHA->new("SharedSecret", "Random01,39j309ad");

$crypted = $hce_sha->hce_block_encrypt("Encrypt this information");
$info = $hce_sha->hce_block_decrypt($crypted);

$mime_crypted = $hce_sha->hce_block_encode_mime("Encrypt and Base64 this information");
$info = $hce_sha->hce_block_decode_mime($mime_crypted);

$hce_sha = Crypt::HCE_SHA->new("key", "random", 256);  # use SHA256 instead of SHA1

look at that last line btw β€” pass 256 as the third arg and you get SHA256 instead of SHA1. glow up πŸ¦‹


🌸 DESCRIPTION 🌸

So this module implements a chaining block cipher using a one way hash. and get this β€” this method of encryption is the same one that radius uses (RFC2138), and it's also described in Applied Cryptography. we're running with the classics, periodt. πŸ‘‘

There are two interfaces in this module, and you're gonna pick your fighter:

  • first one: straight up block encryption/decryption
  • second one: base64 mime encoding/decoding of the encrypted/decrypted blocks

The idea is that the two sides have a shared secret that supplies one of the keys, and a randomly generated block of bytes supplies the second key. and the plot twist? that random key is passed in cleartext between the two sides. yes, cleartext. that's the design, bestie, not a typo. πŸ™ˆ

An example client and server are packaged as modules with this module β€” they're used in the tests, and you can find them in the examples directory. go peek, it's giving tutorial energy. πŸ“

Also, thanks to Jake Angerman for the bug report on the bug in key generation for the chaining portion of the algorithm. real ones report bugs. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Eric Estabrooks, eric@urbanrage.com


πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, fr fr. this one shipped with perl v5.36.0, dated 2022-10-13, and yes it's the HCE_SHA(3pm) page itself. mwah, go encrypt something responsibly πŸ’‹βœ¨πŸŽ€

πŸ“¦ where this page comes from