<?php


function encrypt($data, $key)
{
    $encodedEncryptedData = base64_encode(openssl_encrypt($data, "aes-128-cbc", $key, OPENSSL_RAW_DATA, $key));
    $encryptedPayload = $encodedEncryptedData;
    return $encryptedPayload;
}

function decrypt($data, $key)
{
    $decryptedData = openssl_decrypt(base64_decode($data), "aes-128-cbc", $key, OPENSSL_RAW_DATA, $key);
    return $decryptedData;
}
