[php] openssl encrypt/decrypt(AES-256-ECB)
function encrypt($plaintext, $password) { $method = "AES-256-ECB"; $key = hash('sha256', $password, true); $encrypt_iv = openssl_random_pseudo_bytes(16); $ciphertext = openssl_encrypt($plaintext, $method, $key, OPENSSL_RAW_DATA, $encrypt_iv); $hash = hash_hmac('sha256', $ciphertext . $encrypt_iv, $key, true); return $encrypt_iv . $hash . $ciphertext; } function decrypt($ivHashCiphertext, $passwo..
2022. 8. 9.