PHP Classes

Is this working?

Recommend this page to a friend!

      PHP Encryption Library  >  All threads  >  Is this working?  >  (Un) Subscribe thread alerts  
Subject:Is this working?
Summary:Changing the key
Author:Jason Ellmers
Date:2020-01-29 11:43:28

  1. Is this working?   Reply   Report abuse  
Picture of Jason Ellmers Jason Ellmers - 2020-01-29 11:43:28

I am trying to test the encryption class, and find that even with a static key, the result changes every single time the script is run.

Also if I paste back into the script an encrypted string then even if the key is changed the string is decrypted..... That cant be right surely, because every single person that runs your class would be able to just decrypt strings without knowing the key?

running this code will replicate the issue


use Lablnet\Encryption;

require 'vendor/autoload.php';

$encryption = new Encryption('openssl','test');

//Encrypt the message
$encrypt = $encryption->encrypt('some text');
echo strlen(utf8_decode($encrypt)).'<br>';

echo 'Encrypted text: '.$encrypt;
echo "<br\>";

//Decrypt the message
$decrypt = $encryption->decrypt('SWJuRkE1SmxUS0FrRHpacXc0OG9raXl0MUZITnl3T3ZzM2FjcnlYbWViQT0mJmQwMzg3ZjUxYzliNzdmOThmZTRiNjQ0M2E0ODFiMmQ1');
echo '<br> Decrypted/plain text: '.$decrypt;
$decrypt2 = $encryption->decrypt($encrypt);
echo '<br>Decrypted/plain text: '.$decrypt2;

Can you tell me what the encoded string resolves too? Even though the key that encrypted it was not the one in the script

  2. Re: Is this working?   Reply   Report abuse  
Picture of Muhammad Umer Farooq Muhammad Umer Farooq - 2020-01-29 12:29:32 - In reply to message 1 from Jason Ellmers
Please follow the issue here ...

we will response you their thanks you so much

For more information send a message to info at phpclasses dot org.