### Classes and interfaces

# Crypt_AES¶

Pure-PHP implementation of AES.

« More »

### Constants

## CRYPT_AES_MODE

    CRYPT_AES_MODE

## Encrypt / decrypt using the Code Book Chaining mode.

    CRYPT_AES_MODE_CBC

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29

## Encrypt / decrypt using the Cipher Feedback mode.

    CRYPT_AES_MODE_CFB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29

## Encrypt / decrypt using the Counter mode.

    CRYPT_AES_MODE_CTR

Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29

## Encrypt / decrypt using the Electronic Code Book mode.

    CRYPT_AES_MODE_ECB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29

## Toggles the internal implementation

    CRYPT_AES_MODE_INTERNAL

## Toggles the mcrypt implementation

    CRYPT_AES_MODE_MCRYPT

## Encrypt / decrypt using the Cipher Feedback mode.

    CRYPT_AES_MODE_OFB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29

### Classes and interfaces

# Crypt_DES¶

Pure-PHP implementation of DES.

« More »

### Constants

## Contains array_reverse($keys[CRYPT_DES_ENCRYPT])

    CRYPT_DES_DECRYPT

## Contains array_reverse($keys[CRYPT_DES_DECRYPT])

    CRYPT_DES_ENCRYPT

## CRYPT_DES_MODE

    CRYPT_DES_MODE

## Encrypt / decrypt using the Code Book Chaining mode.

    CRYPT_DES_MODE_CBC

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29

## Encrypt / decrypt using the Cipher Feedback mode.

    CRYPT_DES_MODE_CFB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29

## Encrypt / decrypt using the Counter mode.

    CRYPT_DES_MODE_CTR

Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29

## Encrypt / decrypt using the Electronic Code Book mode.

    CRYPT_DES_MODE_ECB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29

## Toggles the internal implementation

    CRYPT_DES_MODE_INTERNAL

## Toggles the mcrypt implementation

    CRYPT_DES_MODE_MCRYPT

## Encrypt / decrypt using the Cipher Feedback mode.

    CRYPT_DES_MODE_OFB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29

### Classes and interfaces

# Crypt_Hash¶

Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions.

« More »

### Constants

## CRYPT_HASH_MODE

    CRYPT_HASH_MODE

## Toggles the hash() implementation, which works on PHP 5.1.2+.

    CRYPT_HASH_MODE_HASH

## Toggles the internal implementation

    CRYPT_HASH_MODE_INTERNAL

## Toggles the mhash() implementation, which has been deprecated on PHP 5.3.0+.

    CRYPT_HASH_MODE_MHASH

### Classes and interfaces

# Crypt_RC4¶

Pure-PHP implementation of RC4.

« More »

### Constants

## CRYPT_RC4_DECRYPT

    CRYPT_RC4_DECRYPT

## CRYPT_RC4_ENCRYPT

    CRYPT_RC4_ENCRYPT

## CRYPT_RC4_MODE

    CRYPT_RC4_MODE

## Toggles the internal implementation

    CRYPT_RC4_MODE_INTERNAL

## Toggles the mcrypt implementation

    CRYPT_RC4_MODE_MCRYPT

### Classes and interfaces

# Crypt_RSA¶

Pure-PHP PKCS#1 compliant implementation of RSA.

« More »

### Constants

## ASN1 Integer

    CRYPT_RSA_ASN1_INTEGER

## ASN1 Sequence (with the constucted bit set)

    CRYPT_RSA_ASN1_SEQUENCE

## CRYPT_RSA_COMMENT

    CRYPT_RSA_COMMENT

## Use {@link http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding Optimal Asymmetric Encryption Padding} (OAEP) for encryption / decryption.

    CRYPT_RSA_ENCRYPTION_OAEP

Uses sha1 by default.

see | \global\Crypt_RSA::setHash()
see | \global\Crypt_RSA::setMGFHash()

## Use PKCS#1 padding.

    CRYPT_RSA_ENCRYPTION_PKCS1

Although CRYPT_RSA_ENCRYPTION_OAEP offers more security, including PKCS#1 padding is necessary for purposes of backwards compatability with protocols (like SSH-1) written before OAEP's introduction.

## CRYPT_RSA_EXPONENT

    CRYPT_RSA_EXPONENT

## CRYPT_RSA_MODE

    CRYPT_RSA_MODE

## To use the pure-PHP implementation

    CRYPT_RSA_MODE_INTERNAL

## To use the OpenSSL library

    CRYPT_RSA_MODE_OPENSSL

(if enabled; otherwise, the internal implementation will be used)

## PKCS#1 formatted private key

    CRYPT_RSA_PRIVATE_FORMAT_PKCS1

Used by OpenSSH

## PuTTY formatted private key

    CRYPT_RSA_PRIVATE_FORMAT_PUTTY

## XML formatted private key

    CRYPT_RSA_PRIVATE_FORMAT_XML

## OpenSSH formatted public key

    CRYPT_RSA_PUBLIC_FORMAT_OPENSSH

Place in $HOME/.ssh/authorized_keys

## PKCS#1 formatted public key

    CRYPT_RSA_PUBLIC_FORMAT_PKCS1

## Raw public key

    CRYPT_RSA_PUBLIC_FORMAT_RAW

An array containing two Math_BigInteger objects.

The exponent can be indexed with any of the following:

0, e, exponent, publicExponent

The modulus can be indexed with any of the following:

1, n, modulo, modulus

## XML formatted public key

    CRYPT_RSA_PUBLIC_FORMAT_XML

## Use the PKCS#1 scheme by default.

    CRYPT_RSA_SIGNATURE_PKCS1

Although CRYPT_RSA_SIGNATURE_PSS offers more security, including PKCS#1 signing is necessary for purposes of backwards compatability with protocols (like SSH-2) written before PSS's introduction.

## Use the Probabilistic Signature Scheme for signing

    CRYPT_RSA_SIGNATURE_PSS

Uses sha1 by default.

see | \global\Crypt_RSA::setSaltLength()
see | \global\Crypt_RSA::setMGFHash()

## CRYPT_RSA_SMALLEST_PRIME

    CRYPT_RSA_SMALLEST_PRIME

### Functions

## Generate a random value.

    crypt_random(\optional $min, \optional $max) : Integer

On 32-bit machines, the largest distance that can exist between $min and $max is 2**31. If $min and $max are farther apart than that then the last ($max - range) numbers.

Depending on how this is being used, it may be worth while to write a replacement. For example, a PHP-based web app that stores its data in an SQL database can collect more entropy than this function can.

access | public

### Parameters

#### $min

`\optional`

Integer $min

#### $max

`\optional`

Integer $max

### Returns

`Integer`

### Classes and interfaces

# Crypt_Rijndael¶

Pure-PHP implementation of Rijndael.

« More »

### Constants

## Encrypt / decrypt using the Code Book Chaining mode.

    CRYPT_RIJNDAEL_MODE_CBC

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29

## Encrypt / decrypt using the Cipher Feedback mode.

    CRYPT_RIJNDAEL_MODE_CFB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29

## Encrypt / decrypt using the Counter mode.

    CRYPT_RIJNDAEL_MODE_CTR

Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29

## Encrypt / decrypt using the Electronic Code Book mode.

    CRYPT_RIJNDAEL_MODE_ECB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29

## Toggles the internal implementation

    CRYPT_RIJNDAEL_MODE_INTERNAL

## Toggles the mcrypt implementation

    CRYPT_RIJNDAEL_MODE_MCRYPT

## Encrypt / decrypt using the Cipher Feedback mode.

    CRYPT_RIJNDAEL_MODE_OFB

link | http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29

### Classes and interfaces

# Crypt_TripleDES¶

Pure-PHP implementation of Triple DES.

« More »

### Constants

## CRYPT_DES_MODE

    CRYPT_DES_MODE

## Encrypt / decrypt using inner chaining

    CRYPT_DES_MODE_3CBC

Inner chaining is used by SSH-1 and is generally considered to be less secure then outer chaining (CRYPT_DES_MODE_CBC3).

## Encrypt / decrypt using outer chaining

    CRYPT_DES_MODE_CBC3

Outer chaining is used by SSH-2 and when the mode is set to CRYPT_DES_MODE_CBC.