affinity4/cipher

密码加密/解密。加密和解密私有字符串。如果您需要将字符串存储为哈希值但同时也想查看其明文形式,则此功能非常有用。**切勿用于密码验证**!

2.0.0 2022-05-25 19:29 UTC

This package is auto-updated.

Last update: 2024-09-26 18:08:36 UTC


README

加密和解密私有字符串。如果您需要将字符串存储为哈希值但同时也想查看其明文形式,则此功能非常有用。

**切勿用于密码验证**!

安装

Composer

composer require affinity4/cipher

使用方法

// 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

许可协议

MIT 2018 Luke Watts