I’m using this code to encrypt:
$content='Hello World';
$output = openssl_encrypt(
$content,
'AES-256-CBC',
'2EE3732CA11BAD106A2429C142136345',
OPENSSL_RAW_DATA,
$iv
);
echo bin2hex($output);
And my output is: bc08212ff2960c50327e4f1585f401b9
But when I use this website https://www.javainuse.com/aesgenerator, my output is:
5415dc0f7cc496be97f2dc9b9d5b2b42
I need this output 5415dc0f7cc496be97f2dc9b9d5b2b42 on my code output.
Because in java programming language I get this result.
String text="Hello World";
String secretKey="2EE3732CA11BAD106A2429C142136345";
IvParameterSpec ivParameterSpec = new IvParameterSpec("0000000000000000".getBytes());
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(), "AES");
Cipher instance = Cipher.getInstance("AES/CBC/PKCS5Padding");
instance.init(1, secretKeySpec, ivParameterSpec);
String output= stringToHex(instance.doFinal(text.getBytes()));
System.out.println(output); //Output: 5415dc0f7cc496be97f2dc9b9d5b2b42
>Solution :
Call the function with ..,$iv = ‘0000000000000000’).
