Initial Commit

This commit is contained in:
Riley Schneider
2025-12-03 16:38:10 +01:00
parent c5e26bf594
commit b732d8d4b5
17680 changed files with 5977495 additions and 2 deletions

View File

@@ -0,0 +1,74 @@
package Crypt::Stream::ChaCha;
use strict;
use warnings;
our $VERSION = '0.069';
use CryptX;
1;
=pod
=head1 NAME
Crypt::Stream::ChaCha - Stream cipher ChaCha
=head1 SYNOPSIS
use Crypt::Stream::ChaCha;
# encrypt
$key = "1234567890123456";
$iv = "123456789012";
$stream = Crypt::Stream::ChaCha->new($key, $iv);
$ct = $stream->crypt("plain message");
# decrypt
$key = "1234567890123456";
$iv = "123456789012";
$stream = Crypt::Stream::ChaCha->new($key, $iv);
$pt = $stream->crypt($ct);
=head1 DESCRIPTION
Provides an interface to the ChaCha stream cipher.
=head1 METHODS
=head2 new
$stream = Crypt::Stream::ChaCha->new($key, $iv);
#or
$stream = Crypt::Stream::ChaCha->new($key, $iv, $counter, $rounds);
# $key .. 32 or 16 bytes
# $iv .. 8 or 12 bytes
# $counter .. initial counter value (DEFAULT: 0)
# $rounds .. rounds (DEFAULT: 20)
=head2 crypt
$ciphertext = $stream->crypt($plaintext);
#or
$plaintext = $stream->crypt($ciphertext);
=head2 keystream
$random_key = $stream->keystream($length);
=head2 clone
$stream->clone();
=head1 SEE ALSO
=over
=item * L<Crypt::Stream::RC4>, L<Crypt::Stream::Sober128>, L<Crypt::Stream::Salsa20>, L<Crypt::Stream::Sosemanuk>
=item * L<https://tools.ietf.org/html/rfc7539>
=back
=cut

View File

@@ -0,0 +1,66 @@
package Crypt::Stream::RC4;
use strict;
use warnings;
our $VERSION = '0.069';
use CryptX;
1;
=pod
=head1 NAME
Crypt::Stream::RC4 - Stream cipher RC4
=head1 SYNOPSIS
use Crypt::Stream::RC4;
# encrypt
$key = "1234567890123456";
$stream = Crypt::Stream::RC4->new($key);
$ct = $stream->crypt("plain message");
# decrypt
$key = "1234567890123456";
$stream = Crypt::Stream::RC4->new($key);
$pt = $stream->crypt($ct);
=head1 DESCRIPTION
Provides an interface to the RC4 stream cipher.
=head1 METHODS
=head2 new
$stream = Crypt::Stream::RC4->new($key);
# $key .. length 5-256 bytes (40 - 2048 bits)
=head2 crypt
$ciphertext = $stream->crypt($plaintext);
#or
$plaintext = $stream->crypt($ciphertext);
=head2 keystream
$random_key = $stream->keystream($length);
=head2 clone
$stream->clone();
=head1 SEE ALSO
=over
=item * L<Crypt::Stream::ChaCha>, L<Crypt::Stream::Sober128>, L<Crypt::Stream::Salsa20>, L<Crypt::Stream::Sosemanuk>
=item * L<https://en.wikipedia.org/wiki/RC4_cipher|https://en.wikipedia.org/wiki/RC4_cipher>
=back
=cut

View File

@@ -0,0 +1,72 @@
package Crypt::Stream::Rabbit;
use strict;
use warnings;
our $VERSION = '0.069';
use CryptX;
1;
=pod
=head1 NAME
Crypt::Stream::Rabbit - Stream cipher Rabbit
=head1 SYNOPSIS
use Crypt::Stream::Rabbit;
# encrypt
$key = "1234567890123456";
$iv = "12345678";
$stream = Crypt::Stream::Rabbit->new($key, $iv);
$ct = $stream->crypt("plain message");
# decrypt
$key = "1234567890123456";
$iv = "12345678";
$stream = Crypt::Stream::Rabbit->new($key, $iv);
$pt = $stream->crypt($ct);
=head1 DESCRIPTION
Provides an interface to the Rabbit stream cipher.
=head1 METHODS
=head2 new
$stream = Crypt::Stream::Rabbit->new($key, $iv);
# $key .. keylen must be up to 16 bytes
# $iv .. ivlen must be up to 8 bytes
$stream = Crypt::Stream::Rabbit->new($key);
#BEWARE: this is different from new($key, "")
=head2 crypt
$ciphertext = $stream->crypt($plaintext);
#or
$plaintext = $stream->crypt($ciphertext);
=head2 keystream
$random_key = $stream->keystream($length);
=head2 clone
$stream->clone();
=head1 SEE ALSO
=over
=item * L<Crypt::Stream::RC4>, L<Crypt::Stream::ChaCha>, L<Crypt::Stream::Salsa20>, L<Crypt::Stream::Sober128>
=item * L<https://en.wikipedia.org/wiki/Rabbit_(cipher)>
=back
=cut

View File

@@ -0,0 +1,72 @@
package Crypt::Stream::Salsa20;
use strict;
use warnings;
our $VERSION = '0.069';
use CryptX;
1;
=pod
=head1 NAME
Crypt::Stream::Salsa20 - Stream cipher Salsa20
=head1 SYNOPSIS
use Crypt::Stream::Salsa20;
# encrypt
$key = "1234567890123456";
$iv = "12345678";
$stream = Crypt::Stream::Salsa20->new($key, $iv);
$ct = $stream->crypt("plain message");
# decrypt
$key = "1234567890123456";
$iv = "12345678";
$stream = Crypt::Stream::Salsa20->new($key, $iv);
$pt = $stream->crypt($ct);
=head1 DESCRIPTION
Provides an interface to the Salsa20 stream cipher.
=head1 METHODS
=head2 new
$stream = Crypt::Stream::Salsa20->new($key, $iv);
#or
$stream = Crypt::Stream::Salsa20->new($key, $iv, $counter, $rounds);
# $key .. 32 or 16 bytes
# $iv .. 8 bytes
# $counter .. initial counter value (DEFAULT: 0)
# $rounds .. rounds (DEFAULT: 20)
=head2 crypt
$ciphertext = $stream->crypt($plaintext);
#or
$plaintext = $stream->crypt($ciphertext);
=head2 keystream
$random_key = $stream->keystream($length);
=head2 clone
$stream->clone();
=head1 SEE ALSO
=over
=item * L<Crypt::Stream::ChaCha>, L<Crypt::Stream::RC4>, L<Crypt::Stream::Sober128>, L<Crypt::Stream::Sosemanuk>
=back
=cut

View File

@@ -0,0 +1,69 @@
package Crypt::Stream::Sober128;
use strict;
use warnings;
our $VERSION = '0.069';
use CryptX;
1;
=pod
=head1 NAME
Crypt::Stream::Sober128 - Stream cipher Sober128
=head1 SYNOPSIS
use Crypt::Stream::Sober128;
# encrypt
$key = "1234567890123456";
$iv = "123456789012";
$stream = Crypt::Stream::Sober128->new($key, $iv);
$ct = $stream->crypt("plain message");
# decrypt
$key = "1234567890123456";
$iv = "123456789012";
$stream = Crypt::Stream::Sober128->new($key, $iv);
$pt = $stream->crypt($ct);
=head1 DESCRIPTION
Provides an interface to the Sober128 stream cipher.
=head1 METHODS
=head2 new
$stream = Crypt::Stream::Sober128->new($key, $iv);
# $key .. keylen must be multiple of 4 bytes
# $iv .. ivlen must be multiple of 4 bytes
=head2 crypt
$ciphertext = $stream->crypt($plaintext);
#or
$plaintext = $stream->crypt($ciphertext);
=head2 keystream
$random_key = $stream->keystream($length);
=head2 clone
$stream->clone();
=head1 SEE ALSO
=over
=item * L<Crypt::Stream::RC4>, L<Crypt::Stream::ChaCha>, L<Crypt::Stream::Salsa20>, L<Crypt::Stream::Sosemanuk>
=item * L<https://en.wikipedia.org/wiki/SOBER-128|https://en.wikipedia.org/wiki/SOBER-128>
=back
=cut

View File

@@ -0,0 +1,69 @@
package Crypt::Stream::Sosemanuk;
use strict;
use warnings;
our $VERSION = '0.069';
use CryptX;
1;
=pod
=head1 NAME
Crypt::Stream::Sosemanuk - Stream cipher Sosemanuk
=head1 SYNOPSIS
use Crypt::Stream::Sosemanuk;
# encrypt
$key = "1234567890123456";
$iv = "123456789012";
$stream = Crypt::Stream::Sosemanuk->new($key, $iv);
$ct = $stream->crypt("plain message");
# decrypt
$key = "1234567890123456";
$iv = "123456789012";
$stream = Crypt::Stream::Sosemanuk->new($key, $iv);
$pt = $stream->crypt($ct);
=head1 DESCRIPTION
Provides an interface to the Sosemanuk stream cipher.
=head1 METHODS
=head2 new
$stream = Crypt::Stream::Sosemanuk->new($key, $iv);
# $key .. keylen must be multiple of 4 bytes
# $iv .. ivlen must be multiple of 4 bytes (OPTIONAL)
=head2 crypt
$ciphertext = $stream->crypt($plaintext);
#or
$plaintext = $stream->crypt($ciphertext);
=head2 keystream
$random_key = $stream->keystream($length);
=head2 clone
$stream->clone();
=head1 SEE ALSO
=over
=item * L<Crypt::Stream::RC4>, L<Crypt::Stream::ChaCha>, L<Crypt::Stream::Salsa20>, L<Crypt::Stream::Sober128>
=item * L<https://en.wikipedia.org/wiki/SOSEMANUK>
=back
=cut