Skip to content
This repository has been archived by the owner on Dec 20, 2017. It is now read-only.

Encryption result of AESCrypt-Android library differs from result in php? #20

Open
puravidaapps opened this issue Jan 1, 2017 · 0 comments

Comments

@puravidaapps
Copy link

According to the usage example, using password = password and message = hello world results in the encrypted message 2B22cS3UC5s35WBihLBo8w==

However in php using the same password and message following the snippet here results in the encrypted message lMwL6ztvVavgsTu7NJE/kw== which is different.

See complete php code snippet here

<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
 <!-- following this snippet<br>
      https://www.urbaninsight.com/2012/06/13/encrypt-and-decrypt-strings-php
 -->

 <?php
  $string = "hello world";
  $password = "password";
  $method = "aes-256-cbc";

  $encrypted = openssl_encrypt($string, $method, $password);
  echo "ENCRYPT:<br>$string<br>$password<br>$encrypted<br><br>";

  $decrypted = openssl_decrypt($encrypted, $method, $password);
  echo "DECRYPT:<br>$encrypted<br>$password<br>$decrypted";
 ?>

 <!-- result: lMwL6ztvVavgsTu7NJE/kw==
  -->

 </body>
</html>

Is the AESCrypt-Android library not compatible with php or is there something, I'm overseeing currently?
Thank you in advance!
Taifun

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant