Created
August 24, 2011 01:35
-
-
Save mythosil/1167107 to your computer and use it in GitHub Desktop.
sample of Crypt::CBC with Rijndael
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use 5.010; | |
use Crypt::CBC; | |
my $cbc = Crypt::CBC->new({ | |
key => 'xxxxxxxxxxxxxxxx', | |
keysize => 16, | |
literal_key => 1, | |
cipher => 'Crypt::Rijndael', | |
iv => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", | |
header => 'none', | |
}); | |
my $string = "Hello World"; | |
my $encrypted = $cbc->encrypt_hex($string); | |
my $decrypted = $cbc->decrypt_hex($encrypted); | |
say $string; | |
say $encrypted; | |
say $decrypted; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment