[Gambas-user] Can I encrypt a string

Mayost Sharon sharon at 455.co.il
Tue Jul 2 22:06:17 CEST 2019


hello

Can I encrypt a string

Such as PHP
$plaintext = "my string sharon";
$ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
$key = "mykey12345678";
$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);
$ciphertext = base64_encode( $iv.$hmac.$ciphertext_raw );

thenk


More information about the User mailing list