Skip to content

Instantly share code, notes, and snippets.

@nihen
Created January 27, 2011 14:21
Show Gist options
  • Save nihen/798558 to your computer and use it in GitHub Desktop.
Save nihen/798558 to your computer and use it in GitHub Desktop.
use utf8;
use Test::More;
use Encode;
use Crypt::TripleDES;
my $plaintext = 'ぴーえすぴー2';
my $passphrase = 'Next Generation Portable';
my $des = new Crypt::TripleDES;
my $cyphertext = $des->encrypt3( Encode::encode('utf-8', $plaintext), $passphrase );
my $decrypt_plaintext = Encode::decode('utf-8', $des->decrypt3( $cyphertext, $passphrase ));
$decrypt_plaintext =~ s/\s*$//g; # whitespaceが後ろについてるので
is $plaintext => $decrypt_plaintext;
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment