Download the PHP package kodhe/encrypt without Composer
On this page you can find all versions of the php package kodhe/encrypt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kodhe/encrypt
More information about kodhe/encrypt
Files in kodhe/encrypt
Informations about the package encrypt
Kodhe Encrypt - Modernized CI3 Encrypt Library
Library enkripsi modern untuk CodeIgniter 3 dengan dukungan OpenSSL, menggantikan library mcrypt yang sudah deprecated.
โ ๏ธ DEPRECATED NOTICE
Library ini DEPRECATED dan dipertahankan hanya untuk backward compatibility. Untuk proyek baru, gunakan library Encryption resmi CodeIgniter 3 yang berbasis OpenSSL.
๐ Fitur Utama
- โ OpenSSL Support: AES-256-CBC + HMAC-SHA256 untuk keamanan maksimal
- โ Backward Compatible: API sama persis dengan CI3 Encrypt lama
- โ Legacy Data Support: Bisa membaca data enkripsi lama (mcrypt)
- โ Tamper Proof: Deteksi otomatis jika data di-tamper
- โ PSR-4 Compliant: Struktur modular dan modern
- โ Performance Optimized: Caching key derivation, batch operations
- โ
Migration Path: Method
migrate()untuk migrasi data lama ke format baru
๐ฆ Instalasi
Atau tambahkan ke composer.json:
๐ง Konfigurasi
Tambahkan di application/config/config.php:
PENTING: Gunakan key minimal 32 karakter untuk keamanan optimal!
๐ก Cara Penggunaan
Gaya CI3 Tradisional
Gaya Modern PSR-4
๐ Keamanan
Format Data Baru (OpenSSL)
- IV (Initialization Vector): Random setiap enkripsi
- HMAC: Mencegah tampering/data manipulation
- AES-256-CBC: Standard industri untuk enkripsi simetris
Deteksi Tampering
๐ Migrasi dari Legacy (mcrypt)
Library ini otomatis mendeteksi dan membaca data legacy CI3:
Script Migrasi Database
๐ API Reference
| Method | Deskripsi | Return |
|---|---|---|
encode($string, $key = '') |
Enkripsi string | string (base64) |
decode($string, $key = '') |
Dekripsi string | string|false |
set_cipher($cipher) |
Set algoritma cipher | self |
set_mode($mode) |
Set mode operasi | self |
sha1($str) |
Generate SHA1 hash | string |
set_key($key) |
Set encryption key | self |
is_legacy_format($string) |
Cek format legacy | bool |
migrate($old_encoded) |
Migrasi ke format baru | string|false |
encode_many($strings, $key) |
Batch enkripsi | array |
decode_many($encoded, $key) |
Batch dekripsi | array |
๐งช Testing
๐ Perbandingan dengan CI3 Asli
| Fitur | CI3 Encrypt (mcrypt) | Kodhe Encrypt (OpenSSL) |
|---|---|---|
| Engine | Mcrypt โ (removed PHP 7.2+) | OpenSSL โ |
| Integritas | โ Tidak ada | โ HMAC-SHA256 |
| Tamper Proof | โ Silent corruption | โ Detect & reject |
| IV Generation | Weak random | โ
random_bytes() |
| Key Derivation | Simple substr | โ HKDF/PBKDF2 |
| Legacy Support | N/A | โ Auto-detect |
| Batch Ops | โ | โ
encode_many() |
โ ๏ธ Security Best Practices
- Gunakan Key Panjang: Minimal 32 karakter
- Simpan Key Aman: Jangan commit ke Git, gunakan environment variables
- Rotate Key Berkala: Ganti encryption key secara periodik
- HTTPS Always: Kirim data terenkripsi hanya via HTTPS
- Migrasi Data Lama: Segera migrate data legacy ke format baru
๐ Changelog
v2.0.0 (2024)
- โ Migrasi penuh dari mcrypt ke OpenSSL
- โ Tambah HMAC untuk integritas data
- โ Support auto-detect legacy format
- โ Batch operations untuk performa
- โ PSR-4 autoloading
v1.0.0 (Legacy)
- Original CI3 Encrypt library compatibility
๐ License
MIT License - see LICENSE file for details.
๐ค Contributing
Contributions welcome! Please read our contributing guidelines before submitting PRs.
๐ Support
- Issues: https://github.com/yourname/ci3-encrypt/issues
- Documentation: https://github.com/yourname/ci3-encrypt/wiki
Note: Library ini untuk CodeIgniter 3. Untuk CodeIgniter 4, gunakan built-in Encryption service.
All versions of encrypt with dependencies
ext-openssl Version *
ext-hash Version *