<?php
define('AES_KEY', 'ROBI');
define('AES_IV', '1234567890123456');

function auth_encode_sha256($data){
    // Generate SHA-256 hash of the data
    $hashedData = hash('sha256', $data);
    return urlencode($hashedData);
}
echo 'cccccccccccccccccccccccccccccccccccccccccccccccccccc';
echo auth_encode_sha256('Fahim@123');
function auth_encode($data){
    $dataToEncrypt = $data;
    $key = AES_KEY;
    $iv = AES_IV;
    $encryptedData = openssl_encrypt($dataToEncrypt, 'aes-256-cbc', $key, 0, $iv);
    return urlencode(base64_encode($encryptedData));
}
// echo auth_encode('fahim1234');


function url_decode($data){
    $encryptedData = base64_decode(urldecode($data));
    $key = AES_KEY;
    $iv = AES_IV;
    $decryptedData = openssl_decrypt($encryptedData, 'aes-256-cbc', $key, 0, $iv);
    return $decryptedData;
}
?>