in reply to Short & Sweet Encryption?
To convert the encrypted text to printable chars, you have to uuencode (or base64 encode) it. Example:
Short enough and (somewhat)secure (well, the above aa.. cipher is silly :-)use Crypt::Twofish2; use MIME::Base64; $cipher = new Crypt::Twofish2 "a" x 32, Crypt::Twofish2::MODE_CBC; my $text = "random text!"; print length($text),": $text\n"; # make text a multiple of 128 bit $text .= " " x (16 - length($text) % 16); $crypted = encode_base64($cipher->encrypt($text)); print length($crypted),": $crypted\n"; __END__ 12: random text! 25: ZA5yODJpIrGnOXpzt3hDVQ==
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ / /\_¯/(q / ---------------------------- \__(m.====·.(_("always off the crowd"))."· ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Short & Sweet Encryption?
by ikegami (Patriarch) on Jul 29, 2006 at 17:49 UTC |