ammarfaizi2 / teacrypt
v1.4
2017-06-02 04:27 UTC
This package is not auto-updated.
Last update: 2025-03-30 04:48:28 UTC
README
Encryption solution
Keunggulan Teacrypt
- Proses enkripsi menggunakan salt. Sehingga hasil enkripsi selalu berbeda walaupun dengan key yang sama.
- Hasil enkripsi dicompress dengan gzdeflate.
- Hasil compress akan diencode dengan base64. Sehingga hasil return akhir selalu printable.
- Hasil dekripsi selalu sama seperti semula jika didekripsi dengan key yang sama.
Contoh
<?php require __DIR__ . '/vendor/autoload.php'; use Teacrypt\Teacrypt; $string = "hello world"; $key = "redangel"; $encrypted_string1 = Teacrypt::encrypt($string, $key); $decrypted_string2 = Teacrypt::decrypt($encrypted_string1, $key); $encrypted_string2 = Teacrypt::encrypt($string, $key); $decrypted_string2 = Teacrypt::decrypt($encrypted_string2, $key); var_dump(array( "hasil kesamaan enkripsi 1 dan 2" => ($encrypted_string1 == $encrypted_string2), "encrypted_string" => array($encrypted_string1, $encrypted_string2), "decrypted_string" => array($decrypted_string2, $decrypted_string2) ));
Akan menghasilkan
array(3) {
["hasil kesamaan enkripsi 1 dan 2"]=>
bool(false)
["encrypted_string"]=>
array(2) {
[0]=>
string(24) "LikCOgUyUFLUmnwMlHXlmLAA"
[1]=>
string(24) "rUjyKKDi3WLS3zadlPndULAA"
}
["decrypted_string"]=>
array(2) {
[0]=>
string(11) "hello world"
[1]=>
string(11) "hello world"
}
}
Installation
Add composer.json
{ "require": { "ammarfaizi2/teacrypt": "1.4" } }