version: 2.1.3
crypto
encrypt or decrypt a text with really high security, action parameter must be enc(mean encrypt) or dec(mean decrypt), string parameter is your hash(received when use encrypt) or the text you want to encrypt, for decrypt , you must have key and iv parameter. you can found them in result of encrypt
Parameters
action | string | What do you want to do? `enc` for encode and `dec` for decode | Yes |
string | string | Your text for encode or decode | Yes |
key | string | Only needed in decode, you receive it when encoded your string | Optional |
iv | string | Only needed in decode , you receive it when encoded your string | Optional |
Method errors
ErrorName | description |
---|---|
action parameter not found | parameter action not founded , set it like example |
string parameter not found | parameter string not founded , set it like example |
key parameter not found | parameter key not founded , set it like example |
iv parameter not found | parameter iv not founded , set it like example |
openssl extension not found | You must install or enable openssl extension otherwise you can't use this method |
Method examples
$this->crypto(['action'=>'dec','string'=>'9LqUf9DSuRRwfo03RnA5Kw==','key'=>'39aaadf402f9b921b1d44e33ee3b022716a518e97d6a7b55de8231de501b4f34','iv'=>'a2e5904a4110169e']);
$this->crypto(['action'=>'enc','string'=>'hello world']);