tigr / compact-encrypter
Data encrypter producing compact and URL-safe output
1.0.0
2023-05-31 14:45 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- ext-openssl: *
Requires (Dev)
- phpunit/phpunit: ^8.1
This package is auto-updated.
Last update: 2024-11-30 02:33:26 UTC
README
Simple compact encrypter
Installation
composer require tigr/compact-encrypter
Why?
It provides very concise encrypted URL-safe data. For instance, it could be used to create self-contained tokens that would contain all the necessary information inside.
How does it work?
- No intermediate base64 or hex encoding, all data is raw binary.
- No JSON, use pack()/unpack().
- Use URL-safe version of base64 (drop trailing '=', replace '/+' with '-_').
- For hashing, use SHA1 instead of SHA256. I know, I know, but for real-world purposes SHA1 is still good enough.
- Allow dropping Mac (validation hash) whatsoever if you want it really short.