<?php
function encrypt($data) {
    $key = $_ENV['ENCRYPTION_KEY'];
    $iv = $_ENV['ENCRYPTION_IV'];
    return base64_encode(openssl_encrypt($data, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv));
}

function decrypt($data) {
    $key = $_ENV['ENCRYPTION_KEY'];
    $iv = $_ENV['ENCRYPTION_IV'];
    return openssl_decrypt(base64_decode($data), 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv);
}
