This Encrypter
class has 3 small methods to Generate Initial Vector, Encrypt String and Decrypt String. The encryption rely on AES-CBC encryption via PHPSecLib. PHPSecLib one of best encryption library which is has a complex mechanism to encrypt anything!
Encrypter::CreateIv()
Encrypter::AESEncrypt()
Encrypter::AESDecrypt()
This method will return random byte.
This random byte will be use as Initial Vector (IV) to encrypt or decrypt string.
$block = Encrypter::CreateIv();
@param1:string -> String to encrypt
@param2:string -> String key, 16 or 32 character.
@param3:byte -> Byte of initial value, can use Encrypter::CreateIv()
This method will return encrypted string as byte.
@param1:byte -> Byte of encrypted string. Can use value from Encrypter::AESEncrypt()
@param2:string -> String of key, 16 or 32 character. Must use the same key while encrypting string.
@param3:byte -> Byte of initial value. Must use the same block byte while encrypting string.
This method will return decrypted byte as string.