All pastes #613737 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-07-11 04:29 UTC
rendered paste body
## init cypher ##
sub init_cypher {
        my $klen = 32;
        my $ivlen = 8;

        my $chars;
        foreach my $char (32..127) {
                if ($char != 92 and $char != 39) { # no \
                        $chars .= chr($char);
                }
        }

        $crypt_key = random_string($klen,$chars);
        $crypt_iv = random_string($ivlen,$chars);

        # generate cipher
1887>   $ci = Crypt::CBC->new({
                key => "$crypt_key",
                cipher => 'Blowfish',
                iv => "$crypt_iv",
                regenerate_key => 0,
                padding => 'space',
                prepend_iv => 0
        });
}
#################