\Pop\CryptMcrypt

Mcrypt class

Summary

Methods
Properties
Constants
setSalt()
getSalt()
generateRandomString()
__construct()
setCipher()
getCipher()
setMode()
getMode()
setSource()
getSource()
getIv()
getIvSize()
create()
decrypt()
verify()
No public properties found
No constants found
strlen()
verifyHash()
$salt
$cipher
$mode
$source
$iv
$ivSize
N/A
No private methods found
No private properties found
N/A

Properties

$salt

$salt : string

Salt

Type

string

$cipher

$cipher : integer

Cipher

Type

integer

$mode

$mode : integer

Mode

Type

integer

$source

$source : integer

Source

Type

integer

$iv

$iv : string

IV

Type

string

$ivSize

$ivSize : integer

IV size

Type

integer

Methods

setSalt()

setSalt(string  $salt = null) : self

Set the salt

Parameters

string $salt

Throws

\Pop\Crypt\Exception

Returns

self

getSalt()

getSalt() : string

Get the salt

Returns

string

generateRandomString()

generateRandomString(integer  $length) : string

Generate a random alphanumeric string of a predefined length.

Parameters

integer $length

Returns

string

__construct()

__construct(string  $salt = null, integer  $cipher = null, integer  $mode = null, integer  $source = null) : self

Constructor

Instantiate the mcrypt object.

Parameters

string $salt
integer $cipher
integer $mode
integer $source

Throws

\Pop\Crypt\Exception

Returns

self

setCipher()

setCipher(integer  $cipher = null) : self

Set the cipher

Parameters

integer $cipher

Returns

self

getCipher()

getCipher() : integer

Get the cipher

Returns

integer

setMode()

setMode(integer  $mode = null) : self

Set the mode

Parameters

integer $mode

Returns

self

getMode()

getMode() : integer

Get the mode

Returns

integer

setSource()

setSource(integer  $source = null) : self

Set the source

Parameters

integer $source

Returns

self

getSource()

getSource() : integer

Get the source

Returns

integer

getIv()

getIv() : string

Get the iv

Returns

string

getIvSize()

getIvSize() : integer

Get the iv size

Returns

integer

create()

create(string  $string) : string

Create the hashed value

Parameters

string $string

Returns

string

decrypt()

decrypt(string  $hash) : string

Decrypt the hashed value

Parameters

string $hash

Returns

string

verify()

verify(string  $string, string  $hash) : boolean

Verify the hashed value

Parameters

string $string
string $hash

Returns

boolean

strlen()

strlen(string  $string) : integer

Get string length

Parameters

string $string

Returns

integer

verifyHash()

verifyHash(string  $string, string  $hash) : boolean

Verify hash, timing-safe.

Credit: Anthony Ferrara's (ircmaxell) password compat library: https://github.com/ircmaxell/password_compat

Parameters

string $string
string $hash

Returns

boolean