Horde_Crypt_Blowfish
in package
Provides blowfish encryption/decryption, with or without a secret key, for PHP strings.
Tags
Table of Contents
- BLOCKSIZE = 8
- IGNORE_MCRYPT = 2
- IGNORE_OPENSSL = 1
- IV_LENGTH = 8
- MAXKEYSIZE = 56
- $cipher : string
- $iv : mixed
- $key : string
- $_crypt : Horde_Crypt_Blowfish_Base
- Blowfish crypt driver.
- __construct() : mixed
- Constructor.
- __get() : mixed
- decrypt() : string
- Decrypts a string.
- encrypt() : string
- Encrypts a string.
- setKey() : mixed
- Sets the secret key.
Constants
BLOCKSIZE
public
mixed
BLOCKSIZE
= 8
IGNORE_MCRYPT
public
mixed
IGNORE_MCRYPT
= 2
IGNORE_OPENSSL
public
mixed
IGNORE_OPENSSL
= 1
IV_LENGTH
public
mixed
IV_LENGTH
= 8
MAXKEYSIZE
public
mixed
MAXKEYSIZE
= 56
Properties
$cipher
public
string
$cipher
The cipher block mode ('ecb' or 'cbc').
$iv
public
mixed
$iv
The initialization vector (false if using 'ecb').
$key
public
string
$key
The encryption key in use.
$_crypt
Blowfish crypt driver.
protected
Horde_Crypt_Blowfish_Base
$_crypt
Methods
__construct()
Constructor.
public
__construct(string $key[, array<string|int, mixed> $opts = array() ]) : mixed
Parameters
- $key : string
-
Encryption key.
- $opts : array<string|int, mixed> = array()
-
Additional options:
- cipher: (string) Either 'ecb' or 'cbc'.
- ignore: (integer) A mask of drivers to ignore (IGNORE_* constants).
- iv: (string) IV to use.
Return values
mixed —__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —decrypt()
Decrypts a string.
public
decrypt(string $text) : string
Parameters
- $text : string
-
The string to decrypt.
Tags
Return values
string —The plaintext.
encrypt()
Encrypts a string.
public
encrypt(string $text) : string
Parameters
- $text : string
-
The string to encrypt.
Tags
Return values
string —The ciphertext.
setKey()
Sets the secret key.
public
setKey(string $key[, string $iv = null ]) : mixed
The key must be non-zero, and less than or equal to MAXKEYSIZE characters (bytes) in length.
Parameters
- $key : string
-
Key must be non-empty and less than MAXKEYSIZE bytes in length.
- $iv : string = null
-
The initialization vector to use. Only needed for 'cbc' cipher. If null, an IV is automatically generated.