view release on metacpan or search on metacpan
SEED_VERIFY.txt view on Meta::CPAN
36:UKEY=rinKey:#n&tf;//P TEXT=rntf(&rkeysadipr RKEY=AA847E37B04240151B7BFAD4E4BE85781BC0859B8FD076859A866B882817295BD80A70F80748339BBA67D8A723F62E35AF57DECB46412C7B909A38231FFFE7F7A15DC4749168AB7393DDC5B11BC7DD038A93C56E78D6FEF41E0C8D973B81F0A59E10A7...
37:UKEY=bData[i]#n#nRoun TEXT=d);for(rint)ioun RKEY=8FEA30611559E9C855220710266FF093F5E2D59D89F6CB50E57D64B44E206A3A8C23FCFE08254732ECA878511D4269C9D2D3660F07699FCF8D994B142C0C4413961D0C41A27007102B995EBEFBDD5BA652A6384611820F431FB5160ABFAF371D05D24D...
38:UKEY=23456789AB566789 TEXT=AA789ABCDEEF&);o RKEY=3789EF65C737A22C83CF9F6D2DE9B3A6066E6C251B9B47FA6E518E055E3B297C44AE9AC5E9B090948D8F2853852E8FFF53BF034D01D04F22A3FCA18186FF70EC47709B4A80A1F89B2C2CEC0E33A7CE068A6AFD37944FC566FA658F2E4017428A51B308...
39:UKEY=&,&01234F&,&0123 TEXT=4CDEF&)1BCD59234 RKEY=CDF737117EBE22D0F8BE6275A7CA684A3998222C238EDA00796BAB738632373BA21F4E0158CADF10D3CD40ACBABFBF803C1E2828AB0D3B7FDF55D6B0CADE5BEBED9318839082B35529C729C550551EDEDD835F48DCF904DFCC4838A647AA7D0E8C6EEA...
40:UKEY=t(&0123456011234 TEXT=5567899EF&);0123 RKEY=7C4CCDC7C737A22C64CAA8132DE9B3A6551DA7572EDE368E7CA3AB9EE5FCD70550FD6C4DB8EF5AB31B4DCB50722166ED04AAD63DACC47A3BEFB6DD8D306190B44814B801A66E0182354B795A4472663A24D513E6A92CCD9B70369859C380AA11248F18...
41:UKEY=BCDEF&,&ABCDEF&, TEXT=&789ABCu67804t(& RKEY=3068B7F0288378BF3ECA1E06A7CA684A2A02ACB707C5A2BF3271DA31170AB0E6E0DAAC5C5C54ED9828ECB128C6650A9930C980FF35531DF5C7CF45A8495F4ED80566BF326C2F80379565CB2A9AA7E6E41E0BA49D35888959E000C61FE25B8560637F0B...
42:UKEY=&);EF&,&01ouF&,& TEXT=00123449ABCDout( RKEY=23D11F74C737A22C955575F141D4F31B7130B5CCF4E8652E12A29C3E9F63687709AA44151394AE9BCD9D6B6F2F69DD022A9ADB2F68A92705BAB0C4F26CF4916A5783BEA50BF8DE1A2A390FEBDE3A1AD134C39D38AF242B75F28A47713112A30EA97E48...
43:UKEY=6789ABCD56789ABC TEXT=D234567F123E&&); RKEY=1350C09FB26EFECCDF11EC95A7CA684AAAEF909170D197020A43ECDA9FB8172538E18783292E76474DF7579426C2FE9222D5F351496F1DB92692647D4C7E6AFD2948A3296C2F8037339A3B4FD0E5AEEEA7F69CDA37BAB96BE2B2C61D72E9374087FA50...
44:UKEY=;i<2d,1:%016,0:% TEXT=0i]);pt1,pdwKey[ RKEY=5B15FA2B9AD15DC7D66AEE2441EFE84B8CF791C871B82DC1CB8E03B8B0B80FC762E3206A81FBBB6EEC7A0E48F116C45DA08D0364643A3B5A3ACD7694505FE085DF3B9D77886DD4D1158022B67F8DD5C082097E1CD413B5DFA725CF1C81A5655AD77FCA...
45:UKEY=ntf(&K%2rintf(&K TEXT=%8X#n&,o8X~d2und RKEY=9502DC5A6F9A78E3D8E9D2A8F82FA58510165CA27145DF0198E18B929DD9E1247C9AADC4F4CEAC428DC250BBE5D4B345F5AF09E0FF2A7BA8EA83CE2E4D76E0EEF89D3B7C22A389971349125903F6542B54E1330844016FB9D6075FEB2BE3B2C10FB3A4...
46:UKEY=&);EF&,&01ouF&,& TEXT=00123449ABCDout( RKEY=23D11F74C737A22C955575F141D4F31B7130B5CCF4E8652E12A29C3E9F63687709AA44151394AE9BCD9D6B6F2F69DD022A9ADB2F68A92705BAB0C4F26CF4916A5783BEA50BF8DE1A2A390FEBDE3A1AD134C39D38AF242B75F28A47713112A30EA97E48...
view all matches for this distribution
view release on metacpan or search on metacpan
}
sub encrypt {
my $this = shift;
my $mime = shift;
# The man page of CMS_encrypt(3) recommends DES-EDE3-CBC
# for interoperability but it can no longer be considered
# to be a safe algorithm. We use AES-128-CBC instead.
my $cipher = shift // "AES-128-CBC";
if(!defined($mime)) {
die __PACKAGE__."#encrypt: ARG[1] is not defined.\n";
} elsif(ref($mime)) {
die __PACKAGE__."#encrypt: ARG[1] is a Ref. [$mime]\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/SRP.pm view on Meta::CPAN
B7C5DA76 F550AA3D 8A1FBFF0 EB19CCB1 A313D55C DA56C9EC 2EF29632
387FE8D7 6E3C0468 043E8F66 3F4860EE 12BF2D5B 0B7474D6 E694F91E
6DBE1159 74A3926F 12FEE5E4 38777CB6 A932DF8C D8BEC4D0 73B931BA
3BC832B6 8D9DD300 741FA7BF 8AFC47ED 2576F693 6BA42466 3AAB639C
5AE4F568 3423B474 2BF1C978 238F16CB E39D652D E3FDB8BE FC848AD9
22222E04 A4037C07 13EB57A8 1A23F0C7 3473FC64 6CEA306B 4BCBC886
2F8385DD FA9D4B7F A2C087E8 79683303 ED5BDD3A 062B3CF5 B3A278A6
6D2A13F8 3F44F82D DF310EE0 74AB6A36 4597E899 A0255DC1 64F31CC5
0846851D F9AB4819 5DED7EA1 B1D510BD 7EE74D73 FAF36BC3 1ECFA268
359046F4 EB879F92 4009438B 481C6CD7 889A002E D5EE382B C9190DA6
FC026E47 9558E447 5677E9AA 9E3050E2 765694DF C81F56E8 80B96E71
view all matches for this distribution
view release on metacpan or search on metacpan
use vars qw(%CIPHERS);
%CIPHERS = (
'NULL-MD5' => "No encryption with a MD5 MAC",
'RC4-MD5' => "128 bit RC4 encryption with a MD5 MAC",
'EXP-RC4-MD5' => "40 bit RC4 encryption with a MD5 MAC",
'RC2-CBC-MD5' => "128 bit RC2 encryption with a MD5 MAC",
'EXP-RC2-CBC-MD5' => "40 bit RC2 encryption with a MD5 MAC",
'IDEA-CBC-MD5' => "128 bit IDEA encryption with a MD5 MAC",
'DES-CBC-MD5' => "56 bit DES encryption with a MD5 MAC",
'DES-CBC-SHA' => "56 bit DES encryption with a SHA MAC",
'DES-CBC3-MD5' => "192 bit EDE3 DES encryption with a MD5 MAC",
'DES-CBC3-SHA' => "192 bit EDE3 DES encryption with a SHA MAC",
'DES-CFB-M1' => "56 bit CFB64 DES encryption with a one byte MD5 MAC",
);
use Crypt::SSLeay::X509;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/Salsa20.pm view on Meta::CPAN
*decrypt = \&encrypt; # In Salsa20, encryption & decryption are the same
#---------------------------------------------------------------------
sub finish { '' } # for Crypt::CBC compatibility
#---------------------------------------------------------------------
sub cryptor { shift->{crypt} }
lib/Crypt/Salsa20.pm view on Meta::CPAN
my $ciphertext = $cryptor->('plaintext');
# encryption & decryption are the same operation:
$salsa20->start; # reset the block counter (keeping key & iv)
my $plaintext = $cryptor->($ciphertext);
# Or use Crypt::CBC-like API:
my $ciphertext = $salsa20->encrypt('plaintext');
my $plaintext = $salsa20->decrypt($ciphertext);
=head1 DESCRIPTION
lib/Crypt/Salsa20.pm view on Meta::CPAN
message1 ^ message2 ^ keystream ^ keystream
message1 ^ message2 ^ 0
message1 ^ message2
=head2 Crypt::Salsa20 vs. Crypt::CBC
The API is similar to that of the L<Crypt::CBC> module, but there are
some differences:
=over
=item 1.
lib/Crypt/Salsa20.pm view on Meta::CPAN
=head2 new
$salsa20 = Crypt::Salsa20->new(-key => $key, ...);
This constructs a new Crypt::Salsa20 object, with attributes supplied
as S<C<< key => value >>> pairs. For compatibility with Crypt::CBC,
attribute names may have a leading hyphen (but unlike Crypt::CBC the
hyphen is not required).
The only required attribute at construction time is the key (but you
must supply an IV before encrypting or decrypting).
lib/Crypt/Salsa20.pm view on Meta::CPAN
Resets the internal block counter, starting the keystream over at the
beginning. You should also change the IV, because using the same key
and IV is a security breach.
For compatibility with the Crypt::CBC method of the same name, you can
pass a parameter (e.g. C<'decrypting'> or C<'encrypting'>), but it is
ignored. With Salsa20, encryption and decryption are the same operation,
so there's no need to indicate which one you want.
This method is primarily for Crypt::CBC compatibility. Since with
Salsa20 you don't need to specify whether you're encrypting or
decrypting, and the C<iv> method also does everything C<start> does,
you don't really need to call this method.
lib/Crypt/Salsa20.pm view on Meta::CPAN
=head2 finish
$remaining_ciphertext = $salsa20->finish;
This method exists solely for Crypt::CBC compatibility. It always
returns the empty string.
=head2 encrypt
view all matches for this distribution
view release on metacpan or search on metacpan
=head1 NAME
Crypt::Serpent - Crypt::CBC compliant Serpent block cipher encryption module
=head1 SYNOPSIS
use Crypt::Serpent;
view all matches for this distribution
view release on metacpan or search on metacpan
__END__
=head1 NAME
Crypt::Shark - Crypt::CBC compliant block cipher
=head1 ABSTRACT
Shark is 64-bit block cipher that accepts a 128-bit key.
Shark is 64-bit block cipher that accepts a 128-bit key. It was
designed by Vincent Rijmen, Joan Daemen, Bart Preneel, Antoon
Bosselaers, and Erik De Win.
This module supports the Crypt::CBC interface, with the following
functions.
=head2 Functions
=over
#!/usr/local/bin/perl
use diagnostics;
use strict;
use warnings;
use Crypt::CBC; # CBC automatically loads Shark for us
# when using Crypt::CBC, key may be of ANY length
my $key = "0123456789abcdef";
# IV must be exactly 16 bytes long
my $IV = pack "H16", 0;
my $cipher = Crypt::CBC->new({'key' => $key,
'cipher' => 'Shark',
'iv' => $IV,
'regenerate_key' => 1,
'padding' => 'standard',
'prepend_iv' => 0
});
# when using Crypt::CBC, plaintext may be of ANY length
my $plaintext1 = "This is a test";
my $ciphertext = $cipher->encrypt($plaintext1);
my $plaintext2 = $cipher->decrypt($ciphertext);
print "Decryption OK\n" if ($plaintext1 eq $plaintext2);
=head1 MORE EXAMPLES
See B<Crypt::CBC> for more examples using CBC mode. See also the
"examples" and "t" directories for some more examples.
=head1 SEE ALSO
B<Crypt::Khazad>, B<Crypt::Misty1>, B<Crypt::Anubis>,
view all matches for this distribution
view release on metacpan or search on metacpan
C<Crypt::Simple> is really just a wrapper round a few other useful Perl
modules: you may want to read the documentation for these modules too.
We use C<FreezeThaw> to squish all your data into a concise textual
representation. We use C<Compress::Zlib> to compress this string, and then use
C<Crypt::Blowfish> in a home-brew CBC mode to perform the encryption.
Somewhere in this process we also add a MD5 digest (using C<Digest::MD5>).
Then we throw the whole thing through C<MIME::Base64> to produce a nice bit of
text for you to play with.
Decryption, obviously, is the reverse of this process.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/Skip32.pm view on Meta::CPAN
code not be used for applications which require a high level of
security.
Reviewers and testers welcomed.
Though this module has been coded to follow a Crypt::CBC usable
interface, it is not intended for use in encrypting long chunks of
text. For those purposes, it is suggested you use another high
quality, proven cipher with a longer block size.
=head1 INSTALLATION
view all matches for this distribution
view release on metacpan or search on metacpan
Skipjack.pm view on Meta::CPAN
__END__
=head1 NAME
Crypt::Skipjack - Crypt::CBC-compliant block cipher
=head1 ABSTRACT
Skipjack is an 80-bit key, 64-bit block cipher designed by the NSA.
Skipjack.pm view on Meta::CPAN
structure had been classified since its introduction in 1993. Skipjack
was unclassified on June 24, 1998.
Skipjack is an 80-bit key, 64-bit block cipher.
This module supports the Crypt::CBC interface, with the following
functions.
=head2 Functions
=over
Skipjack.pm view on Meta::CPAN
#!/usr/local/bin/perl
use diagnostics;
use strict;
use warnings;
use Crypt::CBC; # CBC automatically loads Skipjack for us
# when using Crypt::CBC, key may be of ANY length
my $key = "0123456789abcdef";
# IV must be exactly 8 bytes long
my $IV = pack "H16", 0;
my $cipher = Crypt::CBC->new({'key' => $key,
'cipher' => 'Skipjack',
'iv' => $IV,
'regenerate_key' => 1,
'padding' => 'standard',
'prepend_iv' => 0
});
# when using Crypt::CBC, plaintext may be of ANY length
my $plaintext1 = "This is a test";
my $ciphertext = $cipher->encrypt($plaintext1);
my $plaintext2 = $cipher->decrypt($ciphertext);
print "Decryption OK\n" if ($plaintext1 eq $plaintext2);
=head1 MORE EXAMPLES
See B<Crypt::CBC> for more examples using CBC mode. See also the
"examples" and "t" directories for some more examples.
=head1 SEE ALSO
B<Crypt::Khazad>, B<Crypt::Anubis>, B<Crypt::Noekeon> and
view all matches for this distribution
view release on metacpan or search on metacpan
=item $constant_32 = $cipher->keysize
=item $constant_64 = $cipher->blocksize
These methods are provided for L<Crypt::CBC> compatibility and simply
return C<32> and C<64>, respectively.
Note that it is pointless to use Spritz with L<Crypt::CBC>, as Spritz is
not a block cipher and already provides an appropriate mode.
=back
view all matches for this distribution
view release on metacpan or search on metacpan
__END__
=head1 NAME
Crypt::Square - Crypt::CBC-compliant block cipher
=head1 SYNOPSIS
use Crypt::Square;
Square is a 128-bit block cipher that accepts a 128-bit key. Designed
by Joan Daemen, Vincent Rijmen, and Lars Knudsen, Square is the
predecessor of Rijndael, aka the Advanced Encryption Standard.
This module supports the Crypt::CBC interface, with the following
functions.
=head2 Functions
=over
#!/usr/local/bin/perl
use diagnostics;
use strict;
use warnings;
use Crypt::CBC; # CBC automatically loads Square for us
# when using Crypt::CBC, key may be of ANY length
my $key = "0123456789abcdef";
# IV must be exactly 16 bytes long
my $IV = pack "H32", 0;
my $cipher = Crypt::CBC->new({'key' => $key,
'cipher' => 'Square',
'iv' => $IV,
'regenerate_key' => 1,
'padding' => 'standard',
'prepend_iv' => 0
});
# when using Crypt::CBC, plaintext may be of ANY length
my $plaintext1 = "This is a test";
my $ciphertext = $cipher->encrypt($plaintext1);
my $plaintext2 = $cipher->decrypt($ciphertext);
print "Decryption OK\n" if ($plaintext1 eq $plaintext2);
=head1 MORE EXAMPLES
See B<Crypt::CBC> for more examples using CBC mode. See also the
"examples" and "t" directories for some more examples.
=head1 SEE ALSO
B<Crypt::Khazad>, B<Crypt::Misty1>, B<Crypt::Anubis>,
view all matches for this distribution
view release on metacpan or search on metacpan
__END__
=head1 NAME
Crypt::TC18 - Crypt::CBC compliant block cipher
=head1 ABSTRACT
B<TC18> is 128-bit block cipher that accepts a 64-bit key. TC18 is also
known as B<XSM>.
=head1 DESCRIPTION
TC18 is 128-bit block cipher that accepts a 64-bit key. It was
designed by Tom St. Denis.
This module supports the Crypt::CBC interface, with the following
functions.
=head2 Functions
=over
view all matches for this distribution
view release on metacpan or search on metacpan
depends on a large number of rounds for security, rather than a complex
algorithm. It was developed by David J. Wheeler and Roger M. Needham,
and is described at
L<https://web-beta.archive.org/web/20131226114205/http://www.ftp.cl.cam.ac.uk:80/ftp/papers/djw-rmn/djw-rmn-tea.html>
This module implements TEA encryption. It supports the Crypt::CBC
interface, with the following functions.
=head2 Functions
=over
=head1 SEE ALSO
L<https://web-beta.archive.org/web/20030208020932/http://www.vader.brad.ac.uk/tea/tea.shtml>
Crypt::CBC, Crypt::Blowfish, Crypt::DES
=head1 ACKNOWLEDGEMENTS
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/TEA_PP.pm view on Meta::CPAN
version 0.0308
=head1 SYNOPSIS
use Crypt::TEA_PP;
use Crypt::CBC;
my $tea = Crypt::TEA_PP->new( $key );
my $cbc = Crypt::CBC->new( -cipher => $tea );
my $text = 'The quick brown fox jumps over the lazy dog.';
my $cipher_text = $cbc->encrypt( $text );
my $plain_text = $cbc->decrypt( $cipher_text );
lib/Crypt/TEA_PP.pm view on Meta::CPAN
TEA is a 64-bit symmetric block cipher with a 128-bit key and a variable number of rounds (32 is recommended).
It has a low setup time, and depends on a large number of rounds for security, rather than a complex algorithm.
It was developed by David J. Wheeler and Roger M. Needham,
and is described at L<http://www.ftp.cl.cam.ac.uk/ftp/papers/djw-rmn/djw-rmn-tea.html>
This module implements TEA encryption. It supports the Crypt::CBC interface, with the following functions.
=head1 METHODS
=head2 keysize
Returns the maximum TEA key size, 16 bytes.
=head2 blocksize
Returns the TEA block size, which is 8 bytes. This function exists so that Crypt::TEA_PP can work with Crypt::CBC.
=head2 new
my $tea = Crypt::TEA_PP->new( $key, $rounds );
lib/Crypt/TEA_PP.pm view on Meta::CPAN
=head1 SEE ALSO
L<http://www.vader.brad.ac.uk/tea/tea.shtml>
L<Crypt::CBC>
L<Crypt::TEA_XS>
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/TEA_XS.pm view on Meta::CPAN
version 0.01
=head1 SYNOPSIS
use Crypt::TEA_XS;
use Crypt::CBC;
my $tea = Crypt::TEA_XS->new( $key );
my $cbc = Crypt::CBC->new( -cipher => $tea );
my $text = 'The quick brown fox jumps over the lazy dog.';
my $cipher_text = $cbc->encrypt( $text );
my $plain_text = $cbc->decrypt( $cipher_text );
lib/Crypt/TEA_XS.pm view on Meta::CPAN
TEA is a 64-bit symmetric block cipher with a 128-bit key and a variable number of rounds (32 is recommended).
It has a low setup time, and depends on a large number of rounds for security, rather than a complex algorithm.
It was developed by David J. Wheeler and Roger M. Needham,
and is described at L<http://www.ftp.cl.cam.ac.uk/ftp/papers/djw-rmn/djw-rmn-tea.html>
This module implements TEA encryption. It supports the Crypt::CBC interface, with the following functions.
=head1 METHODS
=head2 keysize
Returns the maximum TEA key size, 16 bytes.
=head2 blocksize
Returns the TEA block size, which is 8 bytes. This function exists so that Crypt::TEA_XS can work with Crypt::CBC.
=head2 new
my $tea = Crypt::TEA_XS->new( $key, $rounds );
lib/Crypt/TEA_XS.pm view on Meta::CPAN
=head1 SEE ALSO
L<http://www.vader.brad.ac.uk/tea/tea.shtml>
L<Crypt::CBC>
L<Crypt::TEA_PP>
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
if ($npads) { $str .= "\0" x $npads; }
my @str = str2binary($str);
my @key = (0x61626364, 0x62636465, 0x63646566, 0x64656667);
my ($cswap, $v0, $v1, $v2, $v3);
my $c0 = 0x61626364; my $c1 = 0x62636465; # CBC Initial Value. Retain !
my $c2 = 0x61626364; my $c3 = 0x62636465; # likewise (abcdbcde).
while (@str) {
# shift 2 blocks off front of str ...
$v0 = shift @str; $v1 = shift @str; $v2 = shift @str; $v3 = shift @str;
# cipher them XOR'd with previous stage ...
# mix up the two cipher blocks with a 4-byte left rotation ...
$cswap = $c0; $c0=$c1; $c1=$c2; $c2=$c3; $c3=$cswap;
}
return ($c0,$c1,$c2,$c3);
}
sub encrypt { my ($str,$key)=@_; # encodes with CBC (Cipher Block Chaining)
return '' unless $str; return '' unless $key;
if ($] > 5.007 && Encode::is_utf8($str)) {
Encode::_utf8_off($str);
# $str = Encode::encode_utf8($str);
}
rand_byte(), rand_byte(), rand_byte(), rand_byte(), rand_byte();
$str = $str . substr($padding,$[,$npads);
}
my @pblocks = str2binary($str);
my $v0; my $v1;
my $c0 = 0x61626364; my $c1 = 0x62636465; # CBC Initial Value. Retain !
my @cblocks;
while (1) {
last unless @pblocks; $v0 = shift @pblocks; $v1 = shift @pblocks;
($c0,$c1) = tea_code($v0^$c0, $v1^$c1, @key);
push @cblocks, $c0, $c1;
}
return str2ascii( binary2str(@cblocks) );
}
sub decrypt { my ($acstr, $key) = @_; # decodes with CBC
use integer;
return '' unless $acstr; return '' unless $key;
@key = binarydigest($key);
my $v0; my $v1; my $c0; my $c1; my @pblocks = (); my $de0; my $de1;
my $lastc0 = 0x61626364; my $lastc1 = 0x62636465; # CBC Init Val. Retain!
my @cblocks = str2binary( ascii2str($acstr) );
while (1) {
last unless @cblocks; $c0 = shift @cblocks; $c1 = shift @cblocks;
($de0, $de1) = tea_decode($c0,$c1, @key);
$v0 = $lastc0 ^ $de0; $v1 = $lastc1 ^ $de1;
}
function binarydigest (str, keystr) { // returns 22-char ascii signature
var key = new Array(); // key = binarydigest(keystr);
key[0]=0x61626364; key[1]=0x62636465; key[2]=0x63646566; key[3]=0x64656667;
// Initial Value for CBC mode = "abcdbcde". Retain for interoperability.
var c0 = new Array(); c0[0] = 0x61626364; c0[1] = 0x62636465;
var c1 = new Array(); c1 = c0;
var v0 = new Array(); var v1 = new Array(); var swap;
var blocks = new Array(); blocks = bytes2blocks(digest_pad(str2bytes(str)));
}
var concat = new Array();
concat[0]=c0[0]; concat[1]=c0[1]; concat[2]=c1[0]; concat[3]=c1[1];
return concat;
}
function encrypt (str,keystr) { // encodes with CBC (Cipher Block Chaining)
if (! keystr) { alert("encrypt: no key"); return false; }
var key = new Array(); key = binarydigest(keystr);
if (! str) return "";
var blocks = new Array(); blocks = bytes2blocks(pad(str2bytes(str)));
var ibl = 0; var nbl = blocks.length;
// Initial Value for CBC mode = "abcdbcde". Retain for interoperability.
var c = new Array(); c[0] = 0x61626364; c[1] = 0x62636465;
var v = new Array(); var cblocks = new Array(); var icb = 0;
while (1) {
if (ibl >= nbl) break;
v[0] = blocks[ibl]; ibl++; v[1] = blocks[ibl]; ibl++;
c = tea_code( xor_blocks(v,c), key );
cblocks[icb] = c[0]; icb++; cblocks[icb] = c[1]; icb++;
}
return binary2ascii(cblocks);
}
function decrypt (ascii, keystr) { // decodes with CBC
if (! keystr) { alert("decrypt: no key"); return false; }
var key = new Array(); key = binarydigest(keystr);
if (! ascii) return "";
var cblocks = new Array(); cblocks = ascii2binary(ascii);
var icbl = 0; var ncbl = cblocks.length;
// Initial Value for CBC mode = "abcdbcde". Retain for interoperability.
var lastc = new Array(); lastc[0] = 0x61626364; lastc[1] = 0x62636465;
var v = new Array(); var c = new Array();
var blocks = new Array(); var ibl = 0;
while (1) {
if (icbl >= ncbl) break;
=over 3
=item I<encrypt>( $plaintext, $key );
Encrypts with CBC (Cipher Block Chaining)
=item I<decrypt>( $cyphertext, $key );
Decrypts with CBC (Cipher Block Chaining)
=item I<asciidigest>( $a_string );
Returns an asciified binary signature of the argument.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/example1.pl view on Meta::CPAN
use 5.010;
use Crypt::TripleDES::CBC;
my $key = pack("H*"
, "1234567890123456"
. "7890123456789012");
my $iv = pack("H*","0000000000000000");
my $crypt = Crypt::TripleDES::CBC->new(
key => $key,
iv => $iv,
);
say unpack("H*",$crypt->encrypt(pack("H*","0ABC0F2241535345631FCE")));
view all matches for this distribution
view release on metacpan or search on metacpan
sub Encipher
{
my ($key, $keylength, $plaintext) = @_;
require Crypt::CBC;
my $cipher = Crypt::CBC->new($key, "Twofish");
return $cipher->encrypt($plaintext);
}
sub Decipher
{
my ($key, $keylength, $ciphertext, $cipherlength) = @_;
require Crypt::CBC;
my $cipher = Crypt::CBC->new($key, "Twofish");
return $cipher->decrypt($ciphertext);
}
sub LastError { ""; }
sub CheckTwofish { undef; }
Twofish is a 128-bit symmetric block cipher with a variable length (128,
192, or 256-bit) key, developed by Counterpane Labs. It is unpatented
and free for all uses, as described at
<URL:http://www.counterpane.com/twofish.html>.
This module implements Twofish encryption. It supports the Crypt::CBC
interface, with the functions described below. It also provides an
interface that is call-compatible with Crypt::Twofish 1.0, but its use
in new code is strongly discouraged.
=head2 Functions
=item keysize
Returns the size (in bytes) of the key. Although the module understands
128, 192, and 256-bit keys, it returns 16 for compatibility with
Crypt::CBC.
=item new($key)
This creates a new Crypt::Twofish object with the specified key (which
should be 16, 24, or 32 bytes long).
=back
=head1 SEE ALSO
Crypt::CBC, Crypt::Blowfish, Crypt::TEA
=head1 ACKNOWLEDGEMENTS
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
Twofish2.pm view on Meta::CPAN
=head1 NAME
Crypt::Twofish2 - Crypt::CBC compliant Twofish encryption module
=head1 SYNOPSIS
use Crypt::Twofish2;
# keysize() is 32, but 24 and 16 are also possible
# blocksize() is 16
$cipher = new Crypt::Twofish2 "a" x 32, Crypt::Twofish2::MODE_CBC;
$crypted = $cipher->encrypt($plaintext);
# - OR -
$plaintext = $cipher->decrypt($crypted);
=head1 DESCRIPTION
This module implements the twofish cipher in a less braindamaged (read:
slow and ugly) way than the existing C<Crypt::Twofish> module.
Although it is C<Crypt::CBC> compliant you usually gain nothing by using
that module (except generality, which is often a good thing), since
C<Crypt::Twofish2> can work in either ECB or CBC mode itself.
=over 4
=cut
Twofish2.pm view on Meta::CPAN
=item keysize
Returns the keysize, which is 32 (bytes). The Twofish2 cipher actually
supports keylengths of 16, 24 or 32 bytes, but there is no way to
communicate this to C<Crypt::CBC>.
=item blocksize
The blocksize for Twofish2 is 16 bytes (128 bits), which is somewhat
unique. It is also the reason I need this module myself ;)
Twofish2.pm view on Meta::CPAN
=item $cipher = new $key [, $mode]
Create a new C<Crypt::Twofish2> cipher object with the given key (which
must be 128, 192 or 256 bits long). The additional C<$mode> argument is
the encryption mode, either C<MODE_ECB> (electronic cookbook mode, the
default), C<MODE_CBC> (cipher block chaining, the same that C<Crypt::CBC>
does) or C<MODE_CFB1> (1-bit cipher feedback mode).
ECB mode is very insecure (read a book on cryptography if you don't know
why!), so you should probably use CBC mode. CFB1 mode is not tested and is
most probably broken, so do not try to use it.
In ECB mode you can use the same cipher object to encrypt and decrypt
data. However, every change of "direction" causes an internal reordering
of key data, which is quite slow, so if you want ECB mode and
encryption/decryption at the same time you should create two seperate
C<Crypt::Twofish2> objects with the same key.
In CBC mode you have to use seperate objects for encryption/decryption in
any case.
The C<MODE_*>-constants are not exported by this module, so you must
specify them as C<Crypt::Twofish2::MODE_CBC> etc. (sorry for that).
=item $cipher->encrypt($data)
Encrypt data. The size of C<$data> must be a multiple of C<blocksize> (16
bytes), otherwise this function will croak. Apart from that, it can be of
Twofish2.pm view on Meta::CPAN
=back
=head1 SEE ALSO
L<Crypt::CBC>, L<Crypt::Twofish>.
=head1 BUGS
Should EXPORT or EXPORT_OK the MODE constants.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/Twofish_PP.pm view on Meta::CPAN
$blocksize = $cipher->blocksize;
$keysize = Crypt::Twofish_PP->keysize;
$blocksize = Crypt::Twofish_PP->blocksize;
use Crypt::CBC;
$cipher = Crypt::CBC->new (key => 'my secret key',
cipher => 'Twofish_PP');
$cipher = Crypt::CBC->new (key => 'my secret key',
cipher => 'Twofish_PP::Key24');
$cipher = Crypt::CBC->new (key => 'my secret key',
cipher => 'Twofish_PP::Key16');
use Crypt::CBC;
use Crypt::Twofish_PP;
$Crypt::Twofish_PP::KEYSIZE = 24;
$cipher = Crypt::CBC->new (key => 'my secret key',
cipher => 'Twofish_PP');
$Crypt::Twofish_PP::KEYSIZE = 32;
$cipher = Crypt::CBC->new (key => 'my secret key',
cipher => 'Twofish_PP');
=head1 DESCRIPTION
Twofish is a 128-bit symmetric block cipher with a variable key length
lib/Crypt/Twofish_PP.pm view on Meta::CPAN
method, it returns the value C<$Crypt::Twofish_PP::KEYSIZE> which
is initialized to 32.
=back
=head1 CIPHER BLOCK CHAINING (CBC) MODE
When encrypting streams of data you will need an additional block
chaining mechanism like CBC as provided by Crypt::CBC(3). When
used with Crypt::CBC(3), Crypt::Twofish_PP(3) will usually work
with a fixed key length of 32 bytes, since Crypt::CBC(3) is not
capable of handling variable length keys.
If you need to use shorter keys with Crypt::CBC(3), you have two
choices: You can either overwrite the variable C<$Crypt::CBC::KEYSIZE>
with the desired length (16 or 24) in bytes, or you can specify
'Twofish_PP::Key16' resp. 'Twofish_PP::Key24' as the cipher algorithm
to Crypt::CBC(3). The modules Crypt::Twofish_PP::Key32(3),
Crypt::Twofish_PP::Key24(3), and Crypt::Twofish_PP::Key16(3), inherit
all functionality from B<Crypt::Twofish_PP> but overwrite the
C<keysize()> method, such that another default key length is reported
back to Crypt::CBC(3).
=head1 UTF-8 NUISANCES
Beginning with Perl 5.6, Perl scalars might be internally flagged as
being UTF-8 strings, and are treated as character-oriented data, not
lib/Crypt/Twofish_PP.pm view on Meta::CPAN
(L<http://www.imperia.net/>).
=head1 SEE ALSO
Crypt::Twofish_PP::Key32(3), Crypt::Twofish_PP::Key24(3),
Crypt::Twofish_PP::Key16(3), Crypt::CBC(3), Crypt::Twofish2(3),
Crypt::Twofish(3), perl(1)
=cut
Local Variables:
mode: perl
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/Util.pm view on Meta::CPAN
collectors => {
defaults => sub { 1 },
},
});
our @KNOWN_AUTHENTICATING_MODES = qw(EAX OCB GCM CWC CCM); # IACBC & IAPM will probably never be implemented
our %KNOWN_AUTHENTICATING_MODES = map { $_ => 1 } @KNOWN_AUTHENTICATING_MODES;
our %FALLBACK_LISTS = (
mode => [qw/CFB CBC Ctr OFB/],
stream_mode => [qw/CFB Ctr OFB/],
block_mode => [qw/CBC/],
authenticated_mode => [qw/EAX GCM CCM/], # OCB/], OCB is patented
cipher => [qw/Rijndael Serpent Twofish RC6 Blowfish RC5/],
#authenticated_cipher => [qw/Phelix SOBER-128 Helix/], # not yet ready
digest => [qw/SHA-1 SHA-256 RIPEMD160 Whirlpool MD5 Haval256/],
mac => [qw/HMAC CMAC/],
lib/Crypt/Util.pm view on Meta::CPAN
sub cipher_object_cbc {
my ( $self, %params ) = _args @_;
$self->_process_params( \%params, qw/cipher/ );
require Crypt::CBC;
Crypt::CBC->new(
-cipher => $params{cipher},
-key => $self->process_key(%params),
);
}
lib/Crypt/Util.pm view on Meta::CPAN
Dependency hell is avoided using a fallback mechanism that tries to choose an
algorithm based on an overridable list.
For "simple" use install Crypt::Util and your favourite digest, cipher and
cipher mode (CBC, CFB, etc).
To ensure predictable behavior the fallback behavior can be disabled as necessary.
=back
lib/Crypt/Util.pm view on Meta::CPAN
=item * mode
The mode in which to use the cipher.
The fallback list is C<CFB>, C<CBC>, C<Ctr>, and C<OFB>.
=item digest
The fallback list is C<SHA-1>, C<SHA-256>, C<RIPEMD160>,
C<Whirlpool>, C<MD5>, and C<Haval256>.
lib/Crypt/Util.pm view on Meta::CPAN
Streams should also be able to used via a simple push api.
=item *
IV/nonce/salt support for the various cipher modes, not just EAX (CBC, CCM, GCM, etc)
=item *
L<Crypt::Rijndael> can do its own cipher modes
=head1 SEE ALSO
L<Digest>, L<Crypt::CBC>, L<Crypt::CFB>,
L<http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation>.
=head1 VERSION CONTROL
This module is maintained using Darcs. You can get the latest version from
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/VERPString.pm view on Meta::CPAN
use strict;
use Carp qw(croak);
#use MIME::Base32 qw(rfc);
use MIME::Base32 qw(crockford);
use Crypt::CBC ();
=head1 NAME
Crypt::VERPString - Encrypt and encode fixed-length records for VERP
lib/Crypt/VERPString.pm view on Meta::CPAN
$self;
}
sub _get_cipher {
my ($self, $iv) = @_;
Crypt::CBC->new({
key => $self->{key},
cipher => $self->{cipher},
iv => pack('NN', $iv, 0), # we could use more entropy...
regenerate_key => 0,
prepend_iv => 0,
lib/Crypt/VERPString.pm view on Meta::CPAN
dorian taylor, C<< <dorian@cpan.org> >>
=head1 SEE ALSO
L<Crypt::CBC>
L<MIME::Base32>
L<http://cr.yp.to/proto/verp.txt>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/XTEA/LE.pm view on Meta::CPAN
version 0.0107
=head1 SYNOPSIS
use Crypt::XTEA:LE;
use Crypt::CBC;
my $xtea = Crypt::XTEA:LE->new( $key, 32, little_endian => 1 );
my $cbc = Crypt::CBC->new( -cipher => $xtea );
my $text = 'The quick brown fox jumps over the lazy dog.';
my $cipher_text = $cbc->encrypt( $text );
my $plain_text = $cbc->decrypt( $cipher_text );
lib/Crypt/XTEA/LE.pm view on Meta::CPAN
It is not subject to any patents.
Like TEA, XTEA is a 64-bit block Feistel cipher with a 128-bit key and a suggested 64 Feistel rounds (i.e 32 cycles).
Crypt::XTEA::LE, uses the recommended value of 32 by default.
This module implements XTEA encryption. It supports the Crypt::CBC interface, with the following functions.
=head1 METHODS
=head2 keysize
Returns the maximum XTEA key size, 16 bytes.
=head2 blocksize
Returns the XTEA::LE block size, which is 8 bytes. This function exists so that Crypt::XTEA:LE can work with Crypt::CBC.
=head2 new
my $xtea = Crypt::XTEA::LE->new( $key, $rounds, little_endian => 0 );
lib/Crypt/XTEA/LE.pm view on Meta::CPAN
=head1 SEE ALSO
Based on L<Crypt::XTEA>
L<Crypt::CBC>
L<Crypt::XTEA_PP>
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/XTEA.pm view on Meta::CPAN
version 0.0108
=head1 SYNOPSIS
use Crypt::XTEA;
use Crypt::CBC;
my $xtea = Crypt::XTEA->new( $key );
my $cbc = Crypt::CBC->new( -cipher => $xtea );
my $text = 'The quick brown fox jumps over the lazy dog.';
my $cipher_text = $cbc->encrypt( $text );
my $plain_text = $cbc->decrypt( $cipher_text );
lib/Crypt/XTEA.pm view on Meta::CPAN
It is not subject to any patents.
Like TEA, XTEA is a 64-bit block Feistel cipher with a 128-bit key and a suggested 64 Feistel rounds (i.e 32 cycles).
Crypt::XTEA uses the recommended value of 32 cycles by default.
This module implements XTEA encryption. It supports the Crypt::CBC interface, with the following functions.
=head1 METHODS
=head2 keysize
Returns the maximum XTEA key size, 16 bytes.
=head2 blocksize
Returns the XTEA block size, which is 8 bytes. This function exists so that Crypt::XTEA can work with Crypt::CBC.
=head2 new
my $xtea = Crypt::XTEA->new( $key, $rounds, little_endian => 0 );
lib/Crypt/XTEA.pm view on Meta::CPAN
Decrypts blocksize() bytes of $cipher_text and returns the corresponding plaintext.
=head1 SEE ALSO
L<Crypt::CBC>
L<Crypt::XTEA_PP>
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/XTEA_PP.pm view on Meta::CPAN
version 0.0106
=head1 SYNOPSIS
use Crypt::XTEA_PP;
use Crypt::CBC;
my $xtea = Crypt::XTEA_PP->new( $key );
my $cbc = Crypt::CBC->new( -cipher => $xtea );
my $text = 'The quick brown fox jumps over the lazy dog.';
my $cipher_text = $cbc->encrypt( $text );
my $plain_text = $cbc->decrypt( $cipher_text );
lib/Crypt/XTEA_PP.pm view on Meta::CPAN
It is not subject to any patents.
Like TEA, XTEA is a 64-bit block Feistel cipher with a 128-bit key and a suggested 64 rounds.
But in Crypt::XTEA_PP, the recommended value for $rounds is 32.
This module implements XTEA encryption. It supports the Crypt::CBC interface, with the following functions.
=head1 METHODS
=head2 keysize
Returns the maximum XTEA key size, 16 bytes.
=head2 blocksize
Returns the XTEA block size, which is 8 bytes. This function exists so that Crypt::XTEA_PP can work with Crypt::CBC.
=head2 new
my $xtea = Crypt::XTEA_PP->new( $key, $rounds );
lib/Crypt/XTEA_PP.pm view on Meta::CPAN
Decrypts blocksize() bytes of $cipher_text and returns the corresponding plaintext.
=head1 SEE ALSO
L<Crypt::CBC>
=head1 AUTHOR
Kars Wang <jahiy@cpan.org>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/XXTEA_PP.pm view on Meta::CPAN
version 0.0102
=head1 SYNOPSIS
use Crypt::XXTEA_PP;
use Crypt::CBC;
my $xxtea = Crypt::XXTEA_PP->new( $key );
my $cbc = Crypt::CBC->new( -cipher => $xxtea );
my $text = 'The quick brown fox jumps over the lazy dog.';
my $cipher_text = $cbc->encrypt( $text );
my $plain_text = $cbc->decrypt( $cipher_text );
lib/Crypt/XXTEA_PP.pm view on Meta::CPAN
Formally speaking, XXTEA is a consistent incomplete source-heavy heterogeneous UFN (unbalanced Feistel network) block cipher.
XXTEA operates on variable-length blocks that are some arbitrary multiple of 32 bits in size (minimum 64 bits).
The number of full cycles depends on the block size, but there are at least six (rising to 32 for small block sizes).
This module implements XXTEA encryption. It supports the Crypt::CBC interface, with the following functions.
=head1 METHODS
=head2 keysize
Returns the maximum XXTEA key size, 16 bytes.
=head2 blocksize
Returns the XXTEA block size, which is 8 bytes. This function exists so that Crypt::XXTEA_PP can work with Crypt::CBC.
=head2 new
my $xxtea = Crypt::XXTEA_PP->new( $key );
lib/Crypt/XXTEA_PP.pm view on Meta::CPAN
Decrypts blocksize() bytes of $cipher_text and returns the corresponding plaintext.
=head1 SEE ALSO
L<Crypt::CBC>
L<Crypt::XXTEA_XS>
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/XXTEA_XS.pm view on Meta::CPAN
version 0.0101
=head1 SYNOPSIS
use Crypt::XXTEA_XS;
use Crypt::CBC;
my $xxtea = Crypt::XXTEA_XS->new( $key );
my $cbc = Crypt::CBC->new( -cipher => $xxtea );
my $text = 'The quick brown fox jumps over the lazy dog.';
my $cipher_text = $cbc->encrypt( $text );
my $plain_text = $cbc->decrypt( $cipher_text );
lib/Crypt/XXTEA_XS.pm view on Meta::CPAN
Formally speaking, XXTEA is a consistent incomplete source-heavy heterogeneous UFN (unbalanced Feistel network) block cipher.
XXTEA operates on variable-length blocks that are some arbitrary multiple of 32 bits in size (minimum 64 bits).
The number of full cycles depends on the block size, but there are at least six (rising to 32 for small block sizes).
This module implements XXTEA encryption. It supports the Crypt::CBC interface, with the following functions.
=head1 METHODS
=head2 keysize
Returns the maximum XXTEA key size, 16 bytes.
=head2 blocksize
Returns the XXTEA block size, which is 8 bytes. This function exists so that Crypt::XXTEA_XS can work with Crypt::CBC.
=head2 new
my $xxtea = Crypt::XXTEA_XS->new( $key );
lib/Crypt/XXTEA_XS.pm view on Meta::CPAN
Decrypts blocksize() bytes of $cipher_text and returns the corresponding plaintext.
=head1 SEE ALSO
L<Crypt::CBC>
L<Crypt::XXTEA_PP>
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/Cipher.pm view on Meta::CPAN
# - default_rounds
# - encrypt
# - max_keysize
# - min_keysize
sub keysize { goto \&max_keysize; } # for Crypt::CBC compatibility
sub CLONE_SKIP { 1 } # prevent cloning
1;
lib/Crypt/Cipher.pm view on Meta::CPAN
my $c = Crypt::Cipher->new('AES', $key);
my $blocksize = $c->blocksize;
my $ciphertext = $c->encrypt($plaintext_block); # encrypt 1 block
my $plaintext = $c->decrypt($ciphertext); #decrypt 1 block
### example 2 (using CBC mode)
use Crypt::Mode::CBC;
my $cbc_key = '1234567890abcdef'; # 16 bytes, valid for AES-128
my $iv = 'fedcba0987654321'; # 16 bytes
my $cbc = Crypt::Mode::CBC->new('AES');
my $cbc_ciphertext = $cbc->encrypt("secret data", $cbc_key, $iv);
#### example 3 (compatibility with Crypt::CBC)
use Crypt::CBC;
use Crypt::Cipher;
my $compat_key = '1234567890abcdef'; # 16 bytes, valid for AES-128
my $compat_iv = 'fedcba0987654321'; # 16 bytes
my $cipher = Crypt::Cipher->new('AES', $compat_key);
my $compat_cbc = Crypt::CBC->new( -cipher=>$cipher, -iv=>$compat_iv );
my $compat_ciphertext = $compat_cbc->encrypt("secret data");
=head1 DESCRIPTION
Provides an interface to various symmetric cipher algorithms.
B<Note:> This module only implements single-block encryption and decryption.
For general data, use a block mode such as
L<Crypt::Mode::CBC>, L<Crypt::Mode::CTR>, or L<Crypt::CBC> (which is slower).
=head1 METHODS
Unless noted otherwise, assume C<$c> is an existing cipher object created via
C<new>, for example:
lib/Crypt/Cipher.pm view on Meta::CPAN
my $plaintext = $c->decrypt($ciphertext);
=head2 keysize
Just an alias for B<max_keysize> (needed for L<Crypt::CBC> compatibility).
=head2 max_keysize
Returns the maximum allowed key size in bytes for the given cipher.
view all matches for this distribution