Crypt-GOST
view release on metacpan or search on metacpan
$ciphertext = $cipher->encrypt($plaintext);
$plaintext = $cipher->decrypt($ciphertext);
=head1 DESCRIPTION
GOST 28147-89 is a 64-bit symmetric block cipher with a 256-bit key
developed in the former Soviet Union. Some information on it is
available at <URL:http://vipul.net/gost/>.
This module implements GOST encryption. It supports the Crypt::CBC
interface, with the functions described below. It also provides an
interface that is backwards-compatible with Crypt::GOST 0.41, but its
use in new code is discouraged.
=head2 Functions
=over
=item blocksize
=item decrypt($data)
Decrypts blocksize() bytes of $data and returns the corresponding
plaintext.
=back
=head1 SEE ALSO
Crypt::CBC, Crypt::Twofish, Crypt::TEA
=head1 ACKNOWLEDGEMENTS
=over 4
=item Vipul Ved Prakash
For writing Crypt::GOST 0.41, and reviewing the current version.
=back
$ciphertext = $cipher->encrypt($plaintext);
$plaintext = $cipher->decrypt($ciphertext);
DESCRIPTION
GOST 28147-89 is a 64-bit symmetric block cipher with a 256-bit
key developed in the former Soviet Union. Some information on it
is available at <URL:http://vipul.net/gost/>.
This module implements GOST encryption. It supports the Crypt::CBC
interface, with the functions described below. It also provides
an interface that is backwards- compatible with Crypt::GOST 0.41,
but its use in new code is discouraged.
Functions
blocksize
Returns the size (in bytes) of the block (8, in this case).
keysize
encrypt($data)
Encrypts blocksize() bytes of $data and returns the
corresponding ciphertext.
decrypt($data)
Decrypts blocksize() bytes of $data and returns the
corresponding plaintext.
SEE ALSO
Crypt::CBC, Crypt::Twofish, Crypt::TEA
ACKNOWLEDGEMENTS
Vipul Ved Prakash
For writing Crypt::GOST 0.41, and reviewing the current
version.
AUTHOR
Abhijit Menon-Sen <ams@wiw.org>
Copyright 2001 Abhijit Menon-Sen. All rights reserved.
ok(my $gost = Crypt::GOST->new("abcdefghijklmnop"x2));
ok("aaaabbbb", $gost->decrypt($gost->encrypt("aaaabbbb")));
ok(my $old = Crypt::GOST->new);
$old->generate_sbox($key); $old->generate_keys($key);
ok(
# The old SSdecrypt used to return spurious padding material.
substr($old->SSdecrypt($old->SScrypt($plaintext)), 0, length $plaintext),
$plaintext
);
eval 'use Crypt::CBC';
if ($@) { print "skipping Crypt::CBC test\n"; }
else {
print "trying CBC... ";
my $c = Crypt::CBC->new($key, "GOST") || die "$!\n";
my $t = $c->encrypt_hex($plaintext);
ok($plaintext, $c->decrypt_hex($t));
}
print "\nBenchmarks\n";
{
my $s = Benchmark->new;
for (my $i = 0; $i < 10000; $i++) {
my $c = Crypt::GOST->new($key);
( run in 1.223 second using v1.01-cache-2.11-cpan-e1769b4cff6 )