PHP Класс Phalcon\Legacy\Crypt

Port of Phalcon 2.0.x Phalcon\Crypt. Provides encryption facilities to phalcon applications. $crypt = new \Phalcon\Legacy\Crypt(); $key = 'le password'; $text = 'This is a secret text'; $encrypted = $crypt->encrypt($text, $key); echo $crypt->decrypt($encrypted, $key);
Наследование: implements Phalcon\Legacy\CryptInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$cipher
$key
$mode
$padding

Открытые методы

Метод Описание
decrypt ( string $text, string $key = null ) : string Decrypts a text
decryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string Decrypt a text that is coded as a base64 string
encrypt ( string $text, mixed $key = null ) : string Encrypts a text
encryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string Encrypts a text returning the result as a base64 string
getAvailableCiphers ( ) : array Returns a list of available cyphers
getAvailableModes ( ) : array Returns a list of available modes
getCipher ( ) : string Returns the current cipher
getKey ( ) : string Returns the encryption key
getMode ( ) : string Returns the current encryption mode
setCipher ( string $cipher ) : Phalcon\Legacy\CryptInterface
setKey ( string $key ) : Phalcon\Legacy\CryptInterface Sets the encryption key
setMode ( string $mode ) : Phalcon\Legacy\CryptInterface Sets the encrypt/decrypt mode
setPadding ( integer $scheme ) : Phalcon\Legacy\CryptInterface Changes the padding scheme used

Защищенные методы

Метод Описание
cryptPadText ( string $text, string $mode, integer $blockSize, integer $paddingType ) : string Pads texts before encryption
cryptUnpadText ( string $text, string $mode, integer $blockSize, integer $paddingType ) : string Removes $paddingType padding from text If the function detects that the text was not padded, it will return it unmodified

Описание методов

cryptPadText() защищенный метод

Pads texts before encryption
protected cryptPadText ( string $text, string $mode, integer $blockSize, integer $paddingType ) : string
$text string
$mode string
$blockSize integer
$paddingType integer
Результат string

cryptUnpadText() защищенный метод

Removes $paddingType padding from text If the function detects that the text was not padded, it will return it unmodified
protected cryptUnpadText ( string $text, string $mode, integer $blockSize, integer $paddingType ) : string
$text string Message to be unpadded
$mode string Encryption mode; unpadding is applied only in CBC or ECB mode
$blockSize integer Cipher block size
$paddingType integer Padding scheme
Результат string

decrypt() публичный метод

echo $crypt->decrypt($encrypted, "decrypt password");
public decrypt ( string $text, string $key = null ) : string
$text string
$key string
Результат string

decryptBase64() публичный метод

Decrypt a text that is coded as a base64 string
public decryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string
$text string
$key mixed
$safe boolean
Результат string

encrypt() публичный метод

$encrypted = $crypt->encrypt("Ultra-secret text", "encrypt password");
public encrypt ( string $text, mixed $key = null ) : string
$text string
$key mixed
Результат string

encryptBase64() публичный метод

Encrypts a text returning the result as a base64 string
public encryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string
$text string
$key mixed
$safe boolean
Результат string

getAvailableCiphers() публичный метод

Returns a list of available cyphers
public getAvailableCiphers ( ) : array
Результат array

getAvailableModes() публичный метод

Returns a list of available modes
public getAvailableModes ( ) : array
Результат array

getCipher() публичный метод

Returns the current cipher
public getCipher ( ) : string
Результат string

getKey() публичный метод

Returns the encryption key
public getKey ( ) : string
Результат string

getMode() публичный метод

Returns the current encryption mode
public getMode ( ) : string
Результат string

setCipher() публичный метод

public setCipher ( string $cipher ) : Phalcon\Legacy\CryptInterface
$cipher string
Результат Phalcon\Legacy\CryptInterface

setKey() публичный метод

Sets the encryption key
public setKey ( string $key ) : Phalcon\Legacy\CryptInterface
$key string
Результат Phalcon\Legacy\CryptInterface

setMode() публичный метод

Sets the encrypt/decrypt mode
public setMode ( string $mode ) : Phalcon\Legacy\CryptInterface
$mode string
Результат Phalcon\Legacy\CryptInterface

setPadding() публичный метод

Changes the padding scheme used
public setPadding ( integer $scheme ) : Phalcon\Legacy\CryptInterface
$scheme integer
Результат Phalcon\Legacy\CryptInterface

Описание свойств

$cipher защищенное свойство

protected $cipher

$key защищенное свойство

protected $key

$mode защищенное свойство

protected $mode

$padding защищенное свойство

protected $padding