common.php
public static function OpensslEncryption($plaintext,$key){    
        $ivlen = openssl_cipher_iv_length($cipher="BF-CBC");//openssl_get_cipher_methods ()
        $iv = openssl_random_pseudo_bytes($ivlen);
        $ciphertext_raw = openssl_encrypt($plaintext, $cipher, $key, $options = OPENSSL_RAW_DATA, $iv);
        $hmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary = true);
        return  base64_encode($iv.$hmac.$ciphertext_raw);
    }
public static function OpensslEncryption($plaintext,$key){    
        $ivlen = openssl_cipher_iv_length($cipher="BF-CBC");//openssl_get_cipher_methods ()
        $iv = openssl_random_pseudo_bytes($ivlen);
        $ciphertext_raw = openssl_encrypt($plaintext, $cipher, $key, $options = OPENSSL_RAW_DATA, $iv);
        $hmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary = true);
        return  base64_encode($iv.$hmac.$ciphertext_raw);
    }
public static function OpensslEncryption ( $ plaintext , $ key ) { $ ivlen = openssl_cipher_iv_length ( $ cipher = "BF-CBC" ) ; //openssl_get_cipher_methods ()
 $ iv = openssl_random_pseudo_bytes ( $ ivlen ) ; $ ciphertext_raw = openssl_encrypt ( $ plaintext , $ cipher , $ key , $ options = OPENSSL_RAW_DATA , $ iv ) ; $ hmac = hash_hmac ( 'sha256' , $ ciphertext_raw , $ key , $ as_binary = true ) ; return base64_encode ( $ iv . $ hmac . $ ciphertext_raw ) ; }
Openssl Encryption
Openssl Encryption