NAME

Crypt::MCrypt - Perl interface for libmcrypt C library.

VERSION

version 0.07

SYNOPSIS

    use Crypt::MCrypt;

    my $iv = pack("H*","0000000000000000");
    my $key = pack("H*","1234567890123456" . "7890123456789012" . "1234567890123456");
    my $cipher_text = pack("H*","E9FF3161EE05ABC9" 
        . "7ea3cacb991318aa" 
        . "585379599b0eaabb" 
        . "c4e474ead1956f47" 
        . "6755f13f1af5235d");
    my $algorithm = "tripledes";
    my $mode = "cbc";
    my $obj = Crypt::MCrypt->new(
        algorithm => $algorithm, 
        mode      => $mode,
        key       => $key, 
        iv        => $iv,
    );
    my $plain_text = $obj->decrypt($cipher_text);
    print "\nPLAIN: $plain_text\n";
    print "\nPLAIN in hex: " . unpack("H*",$plain_text) . "\n";
    $cipher_text = $obj->encrypt($plain_text);
    print "\nCIPHER: $cipher_text\n";
    print "\nCIPHER in hex: " . unpack("H*",$cipher_text) . "\n";

DESCRIPTION

This is a perl interface to libmcrypt c library. It exposes the crypto functions provided by the libmcrypt library in a perl interface with a binding code that accounts for null C strings in ciphertext or plain text.

ATTRIBUTES

algorithm

contains the name of the algorithm used to decrypt encrypt blocks of data

mode

contains the name of the block cipher mode of operation used to encrypt/decrypt blocks of data.

key

contains the key for the encryption decryption algorithm

Initialization Vector

contains the Initialization for the first block of data in block cipher mode of operation.

METHODS

$self->decrypt($ciphertext)

decrypt blocks of ciphertext

$self->encrypt($ciphertext)

encrypt blocks of data

USAGE

  • This module provides a object oriented interface to the libmcrypt library. It uses Mo, a scaled down version of Moose without any data checks to improve speed.

see ALSO

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through github at https://github.com/shantanubhadoria/crypt-mcrypt/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/shantanubhadoria/crypt-mcrypt

git clone git://github.com/shantanubhadoria/crypt-mcrypt.git

AUTHOR

Shantanu Bhadoria <shantanu at cpan dott org>

CONTRIBUTORS

  • Shantanu <shantanu@cpan.org>

  • Shantanu Bhadoria <shantanu@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Shantanu Bhadoria.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.