PHP code example of crazy / crypto
1. Go to this page and download the library: Download crazy/crypto library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
crazy / crypto example snippets
// 使用Base64算法加密
$encryptString = Crypto::Base64()->encrypt('Hello world!', 'key123');
// 使用ThinkPHP算法加密
$encryptString = Crypto::Think()->encrypt('Hello world!', 'key123');
Crypto::{加密算法}()->decrypt(string $data, string $key);
// 使用Think算法解密
$data = 'sXym2IR3c62yeqbagn6ZosOq29p_rZTZnNGqoX20c3A';
echo Crypto::Base64()->decrypt($data, 'key123');
// 输出:Hello World!