Twofish(3pm)

πŸ’– Crypt::Twofish πŸ’–

okay bestie, so this is the manual for Crypt::Twofish(3pm) β€” the Perl module that does the Twofish encryption thing. and when I say it does it, I mean it ate. let's get into it 🫢


✨ NAME ✨

Crypt::Twofish β€” literally the Twofish Encryption Algorithm. that's her. that's the whole vibe. πŸ‘‘


🌸 SYNOPSIS 🌸

use Crypt::Twofish;

$cipher = Crypt::Twofish->new($key);

$ciphertext = $cipher->encrypt($plaintext);

$plaintext  = $cipher->decrypt($ciphertext);

four lines. that's it. no cap, that's the entire energy of getting your encrypt on. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so Twofish is a 128-bit symmetric block cipher with a variable length key β€” you can roll with 128, 192, or 256-bit keys, pick your fighter ✨. it was developed by Counterpane Labs, and it is unpatented and free for all uses, exactly as described over at <URL:http://www.counterpane.com/twofish.html>. iconic behavior honestly 🌈

this module implements Twofish encryption. it supports the Crypt::CBC interface, with the functions described down below. it also provides an interface that is call-compatible with Crypt::Twofish 1.0 β€” but bestie, listen to me β€” its use in new code is strongly discouraged. like, it's giving legacy. it's giving nostalgia. do not build your new thing on it, fr fr πŸ’€

πŸ’œ Functions πŸ’œ

  • blocksize β€” returns the size (in bytes) of the block. that's 16 in this case, periodt.
  • keysize β€” returns the size (in bytes) of the key. okay so even though the module fully understands 128, 192, and 256-bit keys, it returns 16 anyway β€” for compatibility with Crypt::CBC. it's doing it for the team 🫢
  • new($key) β€” this creates a new Crypt::Twofish object with the key you specified, which should be 16, 24, or 32 bytes long. choose wisely bestie ✨
  • encrypt($data) β€” encrypts blocksize() bytes of $data and hands you back the corresponding ciphertext. slay πŸ”₯
  • decrypt($data) β€” decrypts blocksize() bytes of $data and hands you back the corresponding plaintext. the reverse girlies, we love them πŸ’–

πŸ‘€ SEE ALSO πŸ‘€

  • Crypt::CBC
  • Crypt::Blowfish
  • Crypt::TEA

the whole cipher friend group. iykyk 🧚


πŸŽ€ ACKNOWLEDGEMENTS πŸŽ€

  • Nishant Kakani β€” for writing Crypt::Twofish 1.0 (and just so we're clear, this version is a complete rewrite). thank you for your service 🫑
  • Tony Cook β€” for making the module work under Activeperl, testing on several platforms, and suggesting that I probe for features via %Config. an absolute legend, no notes ⭐

πŸ‘‘ AUTHOR πŸ‘‘

Abhijit Menon-Sen <ams@toroid.org>

Copyright 2001 Abhijit Menon-Sen.

this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πŸ’œ


okay that's the whole page bestie, you're officially a Twofish girlie now πŸŒΈπŸ’…βœ¨

perl v5.42.3 Β· 2026-08-19 Β· and that's the Crypt::Twofish(3pm) energy, mwah πŸ’‹πŸ¦‹

πŸ“¦ where this page comes from