CryptX

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - fix #67 (better handling of PEM decoding failures)

0.070   2021-02-12
        - fix #66 remove -flto=auto (Makefile.PL)
        - fix #65 typo in docs (lib/Crypt/Cipher.pm)
        - bundled libtomcrypt update branch:develop (commit:910d6252 2021-01-19)

0.069   2020-08-25
        - fix #64 ECC: segfault on invalid input
        - fix #63 ltc Licensing could be clearer (added src/{ltc,ltm}/LICENSE)
        - fix #62 documentation only (Crypt::CBC related)
        - bundled libtomcrypt update branch:develop (commit:d8d7a83b 2020-07-14)

0.068   2020-03-10
        - fix #60 Test failues on macOS Catalina

0.067   2020-02-01
        - new: Crypt::PK::Ed25519
        - new: Crypt::PK::X25519
        - bundled libtomcrypt update branch:develop (commit:1937f412 2019-11-22)

Changes  view on Meta::CPAN


0.063   2018-11-28
        - proper patch for #46 (related to Math::BigInt::LTM)

0.062   2018-10-30
        - bundled libtommath  update branch:develop (commit:8b9f98ba 2018-09-23) + stdint.h workaround
        - bundled libtomcrypt update branch:develop (commit:f413335b 2018-10-29)
        - fix #45 doc only - sign_message_rfc7518 / sign_message_rfc7518
        - fix #46 tests only - t/mbi_ltm_bigintpm.t etc. started to fail with latest Math::BigInt
        - fix #47 gcm_decrypt_verify + chacha20poly1305_decrypt_verify don't verify the tag - SERIOUS SECURITY BUG!
        - improved CBC/ECB padding (using libtomcrypt's functions: padding_depad + padding_pad)
        - enable pkcs#8 encrypted RSA keys (supported by the latest libtomcrypt)
        - exclude wycheproof tests (too big) from dist tarball (via MANIFEST.SKIP)

0.061   2018-06-07
        - bundled libtommath update (+stdint.h workaround)
        - bundled libtomcrypt update (+necessary adaptation)
        - fix #43 HP-UX 11.11 C-ANSI-C has no stdint.h
        - fix #44 Anonymous unions are GNU and C11 (troubles with HP C/aC++, HP-UX 11.31/IA64)

0.060   2018-05-01

Changes  view on Meta::CPAN

        - Win64 compatibility

0.005   2013-04-18
        - added Crypt::PRNG::Fortuna|RC4|Sober128|Yarrow
        - added Crypt::PK::RSA|DSA|ECC|DH

0.004   2013-04-16
        - removing illegal Crypt::Random

0.003   2013-04-16
        - added Crypt::Mode::CBC|CFB|CTR|ECB|OFB
        - added Crypt::AuthEnc::CCM|EAX|GCM|OCB

0.002   2013-04-11
        - first release on CPAN

CryptX.xs  view on Meta::CPAN

  pelican_state state;
  int finalized;
} *Crypt__Mac__Pelican;
typedef struct cryptx_mac_pmac_struct {
  pmac_state state;
  int finalized;
} *Crypt__Mac__PMAC;
typedef struct cryptx_mac_xcbc_struct {
  xcbc_state state;
  int finalized;
} *Crypt__Mac__XCBC;
typedef struct cryptx_mac_poly1305_struct {
  poly1305_state state;
  int finalized;
} *Crypt__Mac__Poly1305;
typedef struct cryptx_mac_blake2s_struct {
  blake2smac_state state;
  int finalized;
} *Crypt__Mac__BLAKE2s;
typedef struct cryptx_mac_blake2b_struct {
  blake2bmac_state state;

CryptX.xs  view on Meta::CPAN

            const char *data = (sv_value && SvOK(*sv_value)) ? SvPVbyte(*sv_value, vlen) : "";
            s_asn1_append_custom_tlv(aTHX_ out, klass, pc, tag, data, (unsigned long)vlen);
        }
    }
    else {
        croak("FATAL: asn1_encode: unsupported type '%s'", type);
    }
}
/* --- end Crypt::ASN1 encoder helpers ------------------------------------- */

typedef struct cbc_struct {             /* used by Crypt::Mode::CBC */
  int cipher_id, cipher_rounds;
  symmetric_CBC state;
  unsigned char pad[MAXBLOCKSIZE];
  int padlen;
  int padding_mode;
  int direction;
} *Crypt__Mode__CBC;

typedef struct ecb_struct {             /* used by Crypt::Mode::ECB */
  int cipher_id, cipher_rounds;
  symmetric_ECB state;
  unsigned char pad[MAXBLOCKSIZE];
  int padlen;
  int padding_mode;
  int direction;
} *Crypt__Mode__ECB;

CryptX.xs  view on Meta::CPAN

INCLUDE: inc/CryptX_Stream_RC4.xs.inc
INCLUDE: inc/CryptX_Stream_Sober128.xs.inc
INCLUDE: inc/CryptX_Stream_Sosemanuk.xs.inc
INCLUDE: inc/CryptX_Stream_Rabbit.xs.inc

INCLUDE: inc/CryptX_Mac_F9.xs.inc
INCLUDE: inc/CryptX_Mac_HMAC.xs.inc
INCLUDE: inc/CryptX_Mac_OMAC.xs.inc
INCLUDE: inc/CryptX_Mac_Pelican.xs.inc
INCLUDE: inc/CryptX_Mac_PMAC.xs.inc
INCLUDE: inc/CryptX_Mac_XCBC.xs.inc
INCLUDE: inc/CryptX_Mac_Poly1305.xs.inc
INCLUDE: inc/CryptX_Mac_BLAKE2s.xs.inc
INCLUDE: inc/CryptX_Mac_BLAKE2b.xs.inc
INCLUDE: inc/CryptX_Mac_KMAC.xs.inc

INCLUDE: inc/CryptX_Mode_CBC.xs.inc
INCLUDE: inc/CryptX_Mode_ECB.xs.inc
INCLUDE: inc/CryptX_Mode_CFB.xs.inc
INCLUDE: inc/CryptX_Mode_OFB.xs.inc
INCLUDE: inc/CryptX_Mode_CTR.xs.inc
#INCLUDE: inc/CryptX_Mode_F8.xs.inc
#INCLUDE: inc/CryptX_Mode_LRW.xs.inc
#INCLUDE: inc/CryptX_Mode_XTS.xs.inc

INCLUDE: inc/CryptX_PRNG.xs.inc

MANIFEST  view on Meta::CPAN

inc/CryptX_KeyDerivation.xs.inc
inc/CryptX_Mac_BLAKE2b.xs.inc
inc/CryptX_Mac_BLAKE2s.xs.inc
inc/CryptX_Mac_F9.xs.inc
inc/CryptX_Mac_HMAC.xs.inc
inc/CryptX_Mac_KMAC.xs.inc
inc/CryptX_Mac_OMAC.xs.inc
inc/CryptX_Mac_Pelican.xs.inc
inc/CryptX_Mac_PMAC.xs.inc
inc/CryptX_Mac_Poly1305.xs.inc
inc/CryptX_Mac_XCBC.xs.inc
inc/CryptX_Mode_CBC.xs.inc
inc/CryptX_Mode_CFB.xs.inc
inc/CryptX_Mode_CTR.xs.inc
inc/CryptX_Mode_ECB.xs.inc
inc/CryptX_Mode_OFB.xs.inc
inc/CryptX_PK_DH.xs.inc
inc/CryptX_PK_DSA.xs.inc
inc/CryptX_PK_ECC.xs.inc
inc/CryptX_PK_Ed25519.xs.inc
inc/CryptX_PK_Ed448.xs.inc
inc/CryptX_PK_RSA.xs.inc

MANIFEST  view on Meta::CPAN

lib/Crypt/Mac.pm
lib/Crypt/Mac/BLAKE2b.pm
lib/Crypt/Mac/BLAKE2s.pm
lib/Crypt/Mac/F9.pm
lib/Crypt/Mac/HMAC.pm
lib/Crypt/Mac/KMAC.pm
lib/Crypt/Mac/OMAC.pm
lib/Crypt/Mac/Pelican.pm
lib/Crypt/Mac/PMAC.pm
lib/Crypt/Mac/Poly1305.pm
lib/Crypt/Mac/XCBC.pm
lib/Crypt/Misc.pm
lib/Crypt/Mode.pm
lib/Crypt/Mode/CBC.pm
lib/Crypt/Mode/CFB.pm
lib/Crypt/Mode/CTR.pm
lib/Crypt/Mode/ECB.pm
lib/Crypt/Mode/OFB.pm
lib/Crypt/PK.pm
lib/Crypt/PK/DH.pm
lib/Crypt/PK/DSA.pm
lib/Crypt/PK/ECC.pm
lib/Crypt/PK/Ed25519.pm
lib/Crypt/PK/Ed448.pm

README.md  view on Meta::CPAN

CryptX - Cryptographic toolkit

# SYNOPSIS

CryptX is the distribution entry point. In normal code, load one of the concrete modules listed below.

    ## one-shot hashing
    use Crypt::Digest qw(digest_data_hex);
    my $sha256 = digest_data_hex('SHA256', 'hello world');

    ## classic AES-CBC encryption with padding
    use Crypt::Mode::CBC;
    my $cbc = Crypt::Mode::CBC->new('AES');
    my $iv = random_bytes(16); # 16-byte AES block-size IV
    my $cbc_ciphertext = $cbc->encrypt('hello world', $key, $iv);

    ## authenticated encryption (AEAD) with AES
    use Crypt::AuthEnc::GCM qw(gcm_encrypt_authenticate);
    my $key = random_bytes(32);   # 32-byte AES-256 key
    my $nonce = random_bytes(12); # 12-byte unique nonce
    my ($ciphertext, $tag) = gcm_encrypt_authenticate('AES', $key, $nonce, 'header', 'hello world');

    ## message authentication

README.md  view on Meta::CPAN

- **RC4** ([Crypt::Stream::RC4](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ARC4)) - **Broken; do not use for new designs.** Provided for
legacy interoperability only.
- **Rabbit**, **Sober128**, **Sosemanuk** ([Crypt::Stream::Rabbit](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ARabbit), [Crypt::Stream::Sober128](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ASober128), [Crypt::Stream::Sosemanuk](https://metacp...
Niche ciphers from the eSTREAM portfolio. Use ChaCha unless a specific protocol requires one of these.

### Block Cipher Modes (without authentication)

Use these only when authentication is handled separately or not needed:

- **CTR** ([Crypt::Mode::CTR](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACTR)) - Turns a block cipher into a stream cipher. Parallelizable.
- **CBC** ([Crypt::Mode::CBC](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACBC)) - Classic mode, needs padding. Prefer CTR or an AEAD mode.
- **ECB** ([Crypt::Mode::ECB](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3AECB)) - **Insecure for most uses.** Each block encrypted independently.

The individual [Crypt::Cipher::AES](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AAES), [Crypt::Cipher::Twofish](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ATwofish), etc. modules implement
raw single-block encryption and are rarely used directly. In almost all cases you should
use them through an AEAD mode ([Crypt::AuthEnc::GCM](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3AGCM), [Crypt::AuthEnc::CCM](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3ACCM)) or a block
cipher mode ([Crypt::Mode::CBC](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACBC), [Crypt::Mode::CTR](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACTR)) instead. When choosing a cipher,
**AES** is the default; it is hardware-accelerated on most modern CPUs.

### Hash Functions

- **SHA-256** / **SHA-384** / **SHA-512** ([Crypt::Digest::SHA256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA256), etc.) - The default
choice for general hashing. Widely supported and well analyzed.
- **SHA3-256** / **SHA3-512** ([Crypt::Digest::SHA3\_256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA3_256), etc.) - Alternative to SHA-2
with a completely different construction (Keccak sponge).
- **BLAKE2b** / **BLAKE2s** ([Crypt::Digest::BLAKE2b\_256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ABLAKE2b_256), etc.) - Very fast, especially
in software. BLAKE2b for 64-bit platforms, BLAKE2s for 32-bit.

README.md  view on Meta::CPAN

- Symmetric ciphers

    [Crypt::Cipher::AES](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AAES), [Crypt::Cipher::Anubis](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AAnubis), [Crypt::Cipher::ARIA](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AARIA), [Crypt::Ciphe...
    [Crypt::Cipher::DES\_EDE](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ADES_EDE), [Crypt::Cipher::IDEA](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AIDEA), [Crypt::Cipher::KASUMI](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AKASUMI), [Cry...
    [Crypt::Cipher::RC2](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ARC2), [Crypt::Cipher::RC5](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ARC5), [Crypt::Cipher::RC6](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ARC6), [Crypt::Cipher::SAFER...
    [Crypt::Cipher::SAFER\_SK128](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASAFER_SK128), [Crypt::Cipher::SAFER\_SK64](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ASAFER_SK64), [Crypt::Cipher::SEED](https://metacpan.org/pod/Crypt%3A%3ACipher...
    [Crypt::Cipher::Twofish](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3ATwofish), [Crypt::Cipher::XTEA](https://metacpan.org/pod/Crypt%3A%3ACipher%3A%3AXTEA)

- Block cipher modes

    [Crypt::Mode::CBC](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACBC), [Crypt::Mode::CFB](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACFB), [Crypt::Mode::CTR](https://metacpan.org/pod/Crypt%3A%3AMode%3A%3ACTR), [Crypt::Mode::ECB](https://metacp...

- Stream ciphers

    [Crypt::Stream::RC4](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ARC4), [Crypt::Stream::ChaCha](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3AChaCha), [Crypt::Stream::XChaCha](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3AXChaCha), [Crypt:...
    [Crypt::Stream::Sober128](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ASober128), [Crypt::Stream::Sosemanuk](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ASosemanuk), [Crypt::Stream::Rabbit](https://metacpan.org/pod/Crypt%3A%3AStream%3A%3ARa...

- Authenticated encryption modes

    [Crypt::AuthEnc::CCM](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3ACCM), [Crypt::AuthEnc::EAX](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3AEAX), [Crypt::AuthEnc::GCM](https://metacpan.org/pod/Crypt%3A%3AAuthEnc%3A%3AGCM), [Crypt::AuthEnc...

README.md  view on Meta::CPAN

    [Crypt::Digest::SHA3\_224](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA3_224), [Crypt::Digest::SHA3\_256](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ASHA3_256), [Crypt::Digest::SHA3\_384](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3...
    [Crypt::Digest::TurboSHAKE](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3ATurboSHAKE), [Crypt::Digest::KangarooTwelve](https://metacpan.org/pod/Crypt%3A%3ADigest%3A%3AKangarooTwelve), [Crypt::Digest::SM3](https://metacpan.org/pod/Crypt%3A%3ADig...

- Checksums

    [Crypt::Checksum::Adler32](https://metacpan.org/pod/Crypt%3A%3AChecksum%3A%3AAdler32), [Crypt::Checksum::CRC32](https://metacpan.org/pod/Crypt%3A%3AChecksum%3A%3ACRC32)

- Message authentication codes

    [Crypt::Mac::BLAKE2b](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3ABLAKE2b), [Crypt::Mac::BLAKE2s](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3ABLAKE2s), [Crypt::Mac::F9](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3AF9), [Crypt::Mac::HMAC](https:...
    [Crypt::Mac::OMAC](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3AOMAC), [Crypt::Mac::Pelican](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3APelican), [Crypt::Mac::PMAC](https://metacpan.org/pod/Crypt%3A%3AMac%3A%3APMAC), [Crypt::Mac::XCBC](https://...

- Public-key cryptography

    [Crypt::PK::RSA](https://metacpan.org/pod/Crypt%3A%3APK%3A%3ARSA), [Crypt::PK::DSA](https://metacpan.org/pod/Crypt%3A%3APK%3A%3ADSA), [Crypt::PK::ECC](https://metacpan.org/pod/Crypt%3A%3APK%3A%3AECC), [Crypt::PK::DH](https://metacpan.org/pod/Cryp...

- Cryptographically secure random number generators

    [Crypt::PRNG::Fortuna](https://metacpan.org/pod/Crypt%3A%3APRNG%3A%3AFortuna), [Crypt::PRNG::Yarrow](https://metacpan.org/pod/Crypt%3A%3APRNG%3A%3AYarrow), [Crypt::PRNG::RC4](https://metacpan.org/pod/Crypt%3A%3APRNG%3A%3ARC4), [Crypt::PRNG::Sober...

- Key derivation functions

inc/CryptX_Mac_XCBC.xs.inc  view on Meta::CPAN

MODULE = CryptX         PACKAGE = Crypt::Mac::XCBC

PROTOTYPES: DISABLE

### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!

Crypt::Mac::XCBC
new(Class, char * cipher_name, SV * key)
    CODE:
    {
        STRLEN k_len=0;
        unsigned char *k=NULL;
        int rv;
        int id;

        id = cryptx_internal_find_cipher(cipher_name);
        if (id == -1) croak("FATAL: find_cipher failed for '%s'", cipher_name);

inc/CryptX_Mac_XCBC.xs.inc  view on Meta::CPAN

        if (rv != CRYPT_OK) {
          Safefree(RETVAL);
          croak("FATAL: xcbc_init failed: %s", error_to_string(rv));
        }
        RETVAL->finalized = 0;
    }
    OUTPUT:
        RETVAL

void
DESTROY(Crypt::Mac::XCBC self)
    CODE:
    {
        zeromem(&self->state, sizeof(xcbc_state));
        Safefree(self);
    }

Crypt::Mac::XCBC
clone(Crypt::Mac::XCBC self)
    CODE:
        Newz(0, RETVAL, 1, struct cryptx_mac_xcbc_struct);
        if (!RETVAL) croak("FATAL: Newz failed");
        Copy(self, RETVAL, 1, struct cryptx_mac_xcbc_struct);
    OUTPUT:
        RETVAL

void
add(Crypt::Mac::XCBC self, ...)
    PPCODE:
    {
        int rv, i;
        STRLEN in_data_len;
        unsigned char *in_data;

        if (self->finalized) croak("FATAL: MAC object already finalized");
        for(i = 1; i < items; i++) {
          in_data = (unsigned char *)SvPVbyte(ST(i), in_data_len);
          if (in_data_len > 0) {
            rv = xcbc_process(&self->state, in_data, (unsigned long)in_data_len);
            if (rv != CRYPT_OK) croak("FATAL: xcbc_process failed: %s", error_to_string(rv));
          }
        }
        XPUSHs(ST(0)); /* return self */
    }

SV *
mac(Crypt::Mac::XCBC self)
    ALIAS:
        hexmac  = 1
        b64mac  = 2
        b64umac = 3
    CODE:
    {
        unsigned char mac[MAXBLOCKSIZE];
        unsigned long maclen, outlen;
        int rv;
        char out[MAXBLOCKSIZE*2+1];

inc/CryptX_Mode_CBC.xs.inc  view on Meta::CPAN

MODULE = CryptX         PACKAGE = Crypt::Mode::CBC

PROTOTYPES: DISABLE

### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY!

Crypt::Mode::CBC
new(Class, char * cipher_name, int padding=1, int rounds=0)
    CODE:
    {
        Newz(0, RETVAL, 1, struct cbc_struct);
        if (!RETVAL) croak("FATAL: Newz failed");
        RETVAL->padding_mode = padding;
        RETVAL->padlen = 0;
        RETVAL->direction = 0;
        RETVAL->cipher_rounds = rounds;
        RETVAL->cipher_id = cryptx_internal_find_cipher(cipher_name);
        if (RETVAL->cipher_id == -1) {
          Safefree(RETVAL);
          croak("FATAL: find_cipher failed for '%s'", cipher_name);
        }
    }
    OUTPUT:
        RETVAL

void
DESTROY(Crypt::Mode::CBC self)
    CODE:
    {
        zeromem(&self->state, sizeof(symmetric_CBC));
        zeromem(self->pad, sizeof(self->pad));
        Safefree(self);
    }

void
start_decrypt(Crypt::Mode::CBC self, SV * key, SV * iv)
    ALIAS:
        start_encrypt = 1
    PPCODE:
    {
        int rv;
        STRLEN k_len=0;
        unsigned char *k=NULL;
        STRLEN i_len=0;
        unsigned char *i=NULL;

inc/CryptX_Mode_CBC.xs.inc  view on Meta::CPAN

        if (rv != CRYPT_OK) {
          croak("FATAL: cbc_start failed: %s", error_to_string(rv));
        }

        self->direction = ix == 1 ? 1 : -1;
        self->padlen = 0;
        XPUSHs(ST(0)); /* return self */
    }

SV *
add(Crypt::Mode::CBC self, ...)
    CODE:
    {
        int rv, has_tmp_block, blen, j;
        unsigned long i;
        STRLEN in_data_len, in_data_start, out_len = 0;
        unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];

        RETVAL = newSVpvn("", 0);
        for (j = 1; j < items; j++) {
          in_data = (unsigned char *)SvPVbyte(ST(j), in_data_len);

inc/CryptX_Mode_CBC.xs.inc  view on Meta::CPAN

              croak("FATAL: call start_decrypt or start_encrypt first (%d)", self->direction);
            }
          }
        }
        if (out_len > 0) SvCUR_set(RETVAL, out_len);
    }
    OUTPUT:
        RETVAL

SV *
finish(Crypt::Mode::CBC self)
    CODE:
    {
        unsigned char tmp_block[MAXBLOCKSIZE];
        int rv;
        unsigned long blen = (&self->state)->ecb.blocklen;
        unsigned long padmode;

        if (self->direction == 1) {
          if (self->padlen < 0 || self->padlen >= (int)blen) croak("FATAL: invalid padlen");
          if (self->padding_mode != 0) {

lib/Crypt/Cipher.pm  view on Meta::CPAN

### the following methods/functions are implemented in XS:
# - new
# - DESTROY
# - blocksize
# - decrypt
# - default_rounds
# - encrypt
# - max_keysize
# - min_keysize

sub keysize { goto \&max_keysize; } # for Crypt::CBC compatibility

sub CLONE_SKIP { 1 } # prevent cloning

1;

=pod

=head1 NAME

Crypt::Cipher - Generic interface to cipher functions

lib/Crypt/Cipher.pm  view on Meta::CPAN

   #### example 1 (encrypting single block)
   use Crypt::Cipher;

   my $key = '1234567890abcdef'; # 16 bytes, valid for AES-128
   my $plaintext_block = '1234567890123456'; # one AES block (16 bytes)
   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:

 my $c = Crypt::Cipher->new('AES', '1234567890abcdef');

=head2 new

lib/Crypt/Cipher.pm  view on Meta::CPAN

=head2 decrypt

Decrypts C<$ciphertext> and returns C<$plaintext>. An empty string is
accepted and returned unchanged; otherwise C<$ciphertext> must be exactly
B<blocksize> bytes long.

 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.

 $c->max_keysize;
 #or
 Crypt::Cipher->max_keysize('AES');
 #or
 Crypt::Cipher::max_keysize('AES');

lib/Crypt/Cipher/AES.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::AES - Symmetric cipher AES (aka Rijndael), key size: 128/192/256 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('AES');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::AES;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::AES', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the AES cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::AES->new($key);

=head2 new

lib/Crypt/Cipher/ARIA.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::ARIA - Symmetric cipher ARIA, key size: 128/192/256 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('ARIA');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::ARIA;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::ARIA', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

I<Since: CryptX-0.090>

This module implements the ARIA cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::ARIA->new($key);

=head2 new

lib/Crypt/Cipher/Anubis.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::Anubis - Symmetric cipher Anubis, key size: 128-320 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('Anubis');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::Anubis;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Anubis', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the Anubis cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::Anubis->new($key);

=head2 new

lib/Crypt/Cipher/Blowfish.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::Blowfish - Symmetric cipher Blowfish, key size: 64-576 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('Blowfish');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::Blowfish;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Blowfish', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the Blowfish cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::Blowfish->new($key);

=head2 new

lib/Crypt/Cipher/CAST5.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::CAST5 - Symmetric cipher CAST5 (aka CAST-128), key size: 40-128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('CAST5');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::CAST5;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::CAST5', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the CAST5 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::CAST5->new($key);

=head2 new

lib/Crypt/Cipher/Camellia.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::Camellia - Symmetric cipher Camellia, key size: 128/192/256 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('Camellia');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::Camellia;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Camellia', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the Camellia cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::Camellia->new($key);

=head2 new

lib/Crypt/Cipher/DES.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::DES - Symmetric cipher DES, key size: 64[56] bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('DES');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::DES;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::DES', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the DES cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::DES->new($key);

=head2 new

lib/Crypt/Cipher/DES_EDE.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::DES_EDE - Symmetric cipher DES_EDE (aka Triple-DES, 3DES), key size: 192[168] bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('DES_EDE');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::DES_EDE;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::DES_EDE', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the DES_EDE cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::DES_EDE->new($key);

=head2 new

lib/Crypt/Cipher/IDEA.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::IDEA - Symmetric cipher IDEA, key size: 128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('IDEA');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::IDEA;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::IDEA', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

I<Since: CryptX-0.055>

This module implements the IDEA cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::IDEA->new($key);

=head2 new

lib/Crypt/Cipher/KASUMI.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::KASUMI - Symmetric cipher KASUMI, key size: 128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('KASUMI');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::KASUMI;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::KASUMI', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the KASUMI cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::KASUMI->new($key);

=head2 new

lib/Crypt/Cipher/Khazad.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::Khazad - Symmetric cipher Khazad, key size: 128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('Khazad');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::Khazad;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Khazad', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the Khazad cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::Khazad->new($key);

=head2 new

lib/Crypt/Cipher/MULTI2.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::MULTI2 - Symmetric cipher MULTI2, key size: 320 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('MULTI2');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::MULTI2;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::MULTI2', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the MULTI2 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::MULTI2->new($key);

=head2 new

lib/Crypt/Cipher/Noekeon.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::Noekeon - Symmetric cipher Noekeon, key size: 128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('Noekeon');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::Noekeon;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Noekeon', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the Noekeon cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::Noekeon->new($key);

=head2 new

lib/Crypt/Cipher/RC2.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::RC2 - Symmetric cipher RC2, key size: 40-1024 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('RC2');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::RC2;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC2', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the RC2 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::RC2->new($key);

=head2 new

lib/Crypt/Cipher/RC5.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::RC5 - Symmetric cipher RC5, key size: 64-1024 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('RC5');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::RC5;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC5', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the RC5 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::RC5->new($key);

=head2 new

lib/Crypt/Cipher/RC6.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::RC6 - Symmetric cipher RC6, key size: 64-1024 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('RC6');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::RC6;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC6', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the RC6 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::RC6->new($key);

=head2 new

lib/Crypt/Cipher/SAFERP.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::SAFERP - Symmetric cipher SAFER+, key size: 128/192/256 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('SAFERP');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::SAFERP;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFERP', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the SAFERP cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::SAFERP->new($key);

=head2 new

lib/Crypt/Cipher/SAFER_K128.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::SAFER_K128 - Symmetric cipher SAFER_K128, key size: 128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('SAFER_K128');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::SAFER_K128;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_K128', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the SAFER_K128 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::SAFER_K128->new($key);

=head2 new

lib/Crypt/Cipher/SAFER_K64.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::SAFER_K64 - Symmetric cipher SAFER_K64, key size: 64 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('SAFER_K64');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::SAFER_K64;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_K64', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the SAFER_K64 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::SAFER_K64->new($key);

=head2 new

lib/Crypt/Cipher/SAFER_SK128.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::SAFER_SK128 - Symmetric cipher SAFER_SK128, key size: 128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('SAFER_SK128');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::SAFER_SK128;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK128', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the SAFER_SK128 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::SAFER_SK128->new($key);

=head2 new

lib/Crypt/Cipher/SAFER_SK64.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::SAFER_SK64 - Symmetric cipher SAFER_SK64, key size: 64 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('SAFER_SK64');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::SAFER_SK64;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK64', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the SAFER_SK64 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::SAFER_SK64->new($key);

=head2 new

lib/Crypt/Cipher/SEED.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::SEED - Symmetric cipher SEED, key size: 128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('SEED');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::SEED;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SEED', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

This module implements the SEED cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::SEED->new($key);

=head2 new

lib/Crypt/Cipher/SM4.pm  view on Meta::CPAN


=pod

=head1 NAME

Crypt::Cipher::SM4 - Symmetric cipher SM4, key size: 128 bits

=head1 SYNOPSIS

  ### example 1
  use Crypt::Mode::CBC;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::Mode::CBC->new('SM4');
  my $ciphertext = $cbc->encrypt("secret data", $key, $iv);

  ### example 2 (slower)
  use Crypt::CBC;
  use Crypt::Cipher::SM4;

  my $key = '...'; # length must be a valid key size for this cipher
  my $iv = '...';  # 16 bytes
  my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SM4', -key=>$key, -iv=>$iv );
  my $ciphertext = $cbc->encrypt("secret data");

=head1 DESCRIPTION

I<Since: CryptX-0.089>

This module implements the SM4 cipher. Its interface is compatible with L<Crypt::CBC>.

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:

 my $c = Crypt::Cipher::SM4->new($key);

=head2 new



( run in 2.101 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )