dandjo / simple-obfuscator
A simple class to encrypt and decrypt strings with a given salt (bijective).
1.0.2
2019-03-27 16:18 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-04-28 04:07:04 UTC
README
A simple class to encrypt and decrypt strings with a given salt (bijective).
Installation
composer require dandjo/simple-obfuscator
Usage
Instantiate the Obfuscator.
// create a new instance $salt = 'my-security-by-obscurity'; $obfuscator = new \Dandjo\SimpleObfuscator\SimpleObfuscator($salt);
Then you can encrypt your string and decrypt the generated hex string.
$encrypted = $obfuscator->encrypt('4711-foobar'); // $encrypted == "6f927ea5a49b7c" $decrypted = $obfuscator->decrypt('6f927ea5a49b7c'); // $decrypted === "4711-foobar"