So, I have 3 Pieces out of 4 working, iOS Encrypt-Decrypt from this Link And I am able to Decrypt the data Encrypted from iOS I am having trouble Encrypting on PHP side. When I do echo Encryption code. PHP prints something like F>HFl8aR what does it mean ?
SALTKEY = 'a16byteslongkey!';
Decryption Code: Working
$result = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, (SALTKEY . str_repeat(chr(0x00), 16)),
base64_decode($text), 'ecb');
$pad_char = ord(substr($result, -1));
return substr($result, 0, strlen($result) - $pad_char);
Encryption Code : Not Working
$result = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, (SALTKEY . str_repeat(chr(0x00), 16)),
base64_encode($text), 'ecb');
$pad_char = ord(substr($result, -1));
return substr($result, 0, strlen($result) - $pad_char);
Results on iOS : Text = "Hello"
Encryption = "7opqbb7sEVNoXplyQv/X8g=="
Decryption of (7opqbb7sEVNoXplyQv/X8g==) = "Hello"Results on PHP : Text = "7opqbb7sEVNoXplyQv/X8g=="
Decryption = "Hello"
Encryption of (Hello) = "_~TPn~p3MF?"