View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Peter Flanigan > Class-Usul > Class::Usul::Crypt



Annotate this POD



Open  0
View/Report Bugs
Module Version: v0.84.1   Source  

Name ^

Class::Usul::Crypt - Encryption / decryption functions

Synopsis ^

   use Class::Usul::Crypt qw(decrypt encrypt);

   my $args = q(); # OR
   my $args = 'salt'; # OR
   my $args = { salt => 'salt', seed => 'whiten this' };

   $args->{cipher} = 'Twofish2'; # Optionally

   my $base64_encrypted_text = encrypt( $args, $plain_text );

   my $plain_text = decrypt( $args, $base64_encrypted_text );

Description ^

Exports a pair of functions to encrypt / decrypt data. Obfuscates the default encryption key

Configuration and Environment ^

The $key can be a string (including the null string) or a hash reference with salt and seed keys. The seed attribute can be a code reference in which case it will be called with no argument and the return value used

Lifted from Acme::Bleach the default seed for the key generator has been whitened and included in this source file

The seed is eval'd in string context and then the salt is concatenated onto it before being passed to create token. Uses this value as the key for a Crypt::CBC object

Subroutines/Methods ^


   my $plain = decrypt( $salt || \%params, $encoded );

Decodes and decrypts the $encoded argument and returns the plain text result. See the "encrypt" method


   my $encoded = encrypt( $salt || \%params, $plain );

Encrypts the plain text passed in the $plain argument and returns it Base64 encoded. By default Crypt::Twofish2 is used to do the encryption. The optional $params->{cipher} attribute overrides this


   @list_of_ciphers = cipher_list();

Returns the list of ciphers supported by Crypt::CBC. These may not all be installed


   $ciper_name = default_cipher();

Returns Twofish2

Diagnostics ^


Dependencies ^


Incompatibilities ^

There are no known incompatibilities in this module

Bugs and Limitations ^

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author ^

Peter Flanigan, <>

License and Copyright ^

Copyright (c) 2018 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

syntax highlighting: