ronakiihglobal/stringcrypto

encrypt decrypt id/string with ease

v1.0.1 2021-05-23 09:20 UTC

This package is not auto-updated.

Last update: 2024-10-07 01:08:02 UTC


README

This is simple package for encrypt/decrypt small strings like database IDs with ease. It is based on openssl_encrypt.

The encrypt method used is AES-256-CBC.

Usage

composer require ronakiihglobal/stringcrypto

then

require_once __DIR__ . '/vendor/autoload.php';

use ronakiihglobal\stringcrypto\Crypto;

$crypto = new Crypto("testkey","testIv"); these values should be random string of length 16 and should be managed as secret in env variables.

$encrypted = $crypto::encrypt("123"); this value should be string.

$decrypted = $crypto::decrypt($encrypted);