my $key = 'somerandomkey'; my $cipher = Crypt::CBC->new( -key => $key, -header => 'randomiv', -cypher => 'Blowfish', ); my $ciphertext = $cipher->encrypt($string); my $safe_data = urlsafe_b64encode($ciphertext);