luckystar / crypto
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/luckystar/crypto
README
This is a simple PHP library that provides a simple interface for encrypting and decrypting data using the OpenSSL extension.
Installation
You can install the library via Composer. Run the following command:
composer require luckystar/crypto
Function list
| Function | Description | Example |
| encrypt | Encrypt the given data | encrypt('Hello, World!') |
| decrypt | Decrypt the given data | decrypt('b0lSSVJzeTUwZ1p4WGpmNUY0Zk55NE9janZaZWM1VVhKUEdVUDBSZWh2WT0=') |
| getOutput | Get the output of the encryption or decryption process | getOutput() |
| setSecretKey | Set the secret key to use for encryption and decryption | setSecretKey('00cccskmmx55') |
| setSecretIv | Set the secret iv to use for encryption and decryption | setSecret('00cccskmmx55') |
| createSecretKey | Create a secret key | createSecretKey() |
| createSecretIv | Create a secret iv | createSecretIv() |
| createRandomString | Create a random string | createRandomString($length) |
| createRandomNumber | Create a random number | createRandomNumber($length) |
| createRandomHex | Create a random hex | createRandomHex($length) |
| createUuid | Create a UUID | createUuid() |
| createRandomPassword | Create a random password | createRandomPassword($length = 10, $useLowercase = true, $useUppercase = true, $useNumbers = true, $useSymbols = true, $customChars = 'custom list') //!@#$%^&*()_+ |
Usage
use \LuckyStar\Crypto\Crypto; // Encrypt data echo $crypto->setSecretIv('00cccskmmx55') ->setSecretKey('00 cccxxx55') ->encrypt('Hello, World!')->getOutput(); // Decrypt data echo $crypto->decrypt('b0lSSVJzeTUwZ1p4WGpmNUY0Zk55NE9janZaZWM1VVhKUEdVUDBSZWh2WT0=')->getOutput();