encode($value, $key = false)
The encode method encrypts a string value, optionally with a custom encryption key.
Static | No | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
|||||||||
Returns | string | |||||||||
Example |
|
The Crypt class allows encrypt or decrypt a string. The Crypt class is also used internally by for example the Fuel Sessions class.
It uses the encryption and hashing methods provided by PHPSecLib, so it's not dependent on external modules being available, such as mcrypt.
Using crypt can be done in 2 ways: through static usage of the Crypt class and through crypt objects returned by the Crypt::forge() or Crypt::instance() methods. This section covers static usage which will always work with the default instance using the configuration specified in the configuration.
Using crypt objects, Crypt::instance() and Crypt::forge() is explained in the advanced section.
The encode method encrypts a string value, optionally with a custom encryption key.
Static | No | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
|||||||||
Returns | string | |||||||||
Example |
|
The decode method decrypts a string value, optionally with a custom key.
Static | No | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
|||||||||
Returns | mixed - String value with the decoded value, or false if the value could not be decoded. | |||||||||
Example |
|