Skip to content

Instantly share code, notes, and snippets.

@s-aska
Created August 12, 2011 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-aska/1141885 to your computer and use it in GitHub Desktop.
Save s-aska/1141885 to your computer and use it in GitHub Desktop.
blowfish
#!/usr/bin/env perl
use strict;
use warnings;
use Crypt::CBC;
use Crypt::Blowfish;
my $key = shift;
my $val = shift;
$key = substr( $key, 0, 56 );
warn $key;
warn length($key);
my $cipher = Crypt::CBC->new(
{
key => $key,
cipher => 'Blowfish',
keysize => length($key),
regenerate_key => 0,
header => 'randomiv',
}
);
use Data::Dumper;
warn Dumper($cipher);
warn $cipher->encrypt_hex($val);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment