<?php

namespace App\Helpers;

class PhoneHelper
{
    public static function encrypt(string $phone): string
    {
        $key = config('app.phone_encrypt_key');
        // $iv = random_bytes(16);
        $iv = "77f*eb51d38[b947";
        $encrypted = openssl_encrypt($phone, 'AES-128-CBC', $key, 0, $iv);
        return base64_encode($encrypted);
    }
    /*
    public static function decrypt(string $encrypted): string
    {
        $key = config('app.phone_encrypt_key');
        [$iv, $data] = explode('||', base64_decode($encrypted));
        return openssl_decrypt($data, 'AES-128-CBC', $key, 0, $iv);
    }*/

}