https://github.com/affinity4/cipher
Encrypt and decrypt private strings. Useful if you need to store a string as a hash but need to see it as plain text also. DO NOT USE FOR PASSWORD AUTHENTICATION!
https://github.com/affinity4/cipher
Last synced: 2 months ago
JSON representation
Encrypt and decrypt private strings. Useful if you need to store a string as a hash but need to see it as plain text also. DO NOT USE FOR PASSWORD AUTHENTICATION!
- Host: GitHub
- URL: https://github.com/affinity4/cipher
- Owner: affinity4
- Created: 2018-04-07T22:18:07.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-05-25T19:32:56.000Z (about 4 years ago)
- Last Synced: 2025-12-14T12:54:06.535Z (6 months ago)
- Language: PHP
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Affinity4 Cipher
Encrypt and decrypt private strings. Useful if you need to store a string as a hash but need to see it as plain text also.
__DO NOT USE FOR PASSWORD AUTHENTICATION!__
## Installation
### Composer
```bash
composer require affinity4/cipher
```
## Usage
```php
// Used by both excrypt and decrypt methods, so should be available globally
// Perhaps as an environment variable
$key = 'b1f1e6225cb2b6d0230b16125e45ca63';
$str = 'my secret';
$encrypted = \Affinity4\Cipher\Cipher::encrypt($str, $key); // piqwpeiqep12801aqwie0248quqjowq==
$decrypted = \Affinity4\Cipher\Cipher::decrypt($encrypted, $key); // my secret
```
## Licence
MIT 2018 Luke Watts