Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emalherbi/myopenssl
MyOpenSSL - encrypt and decrypt
https://github.com/emalherbi/myopenssl
composer decrypt encrypt openssl php
Last synced: about 1 month ago
JSON representation
MyOpenSSL - encrypt and decrypt
- Host: GitHub
- URL: https://github.com/emalherbi/myopenssl
- Owner: emalherbi
- Created: 2022-04-14T17:54:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-14T23:01:57.000Z (over 2 years ago)
- Last Synced: 2024-11-22T17:59:51.915Z (about 2 months ago)
- Topics: composer, decrypt, encrypt, openssl, php
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MyOpenSSL
# Install
```
composer require emalherbi/myopenssl
```# Usage
```php
# require_once '../src/MyOpenSSL.php';
require_once 'vendor/autoload.php';$ivSSL = 'klEUGdjU4M827qruJdLZVTcVYbCsWoVG';
$hashSSL = 'WK3judku9bOVPjprhrvU2xwCPwDNk4QN';$openSSL = new MyOpenSSL\MyOpenSSL($hashSSL, $ivSSL);
$key_public = 'ABC';
echo '
';';
echo 'String Token:'.$key_public."\n";$key_encrypt = $openSSL->encrypt($key_public);
echo 'Encrypted String:'.$key_encrypt."\n";$key_decrypt = $openSSL->decrypt($key_encrypt);
echo 'Decrypted string:'.$key_decrypt."\n";if ($key_public == $key_decrypt) {
echo "Correct authentication\n";
}echo '
```# Output Usage
```
String Token:ABC
Encrypted String:dTBYUE9SZnpHS1BjN0UwcTFQRDBZUT09
Decrypted string:ABC
Correct authentication
```# References
[aalonzolu](https://gist.github.com/aalonzolu/69f63b54b6c94b9518c4e057cc88d267)