Crypt gives different encrypted values for same source-text


I'm using Phalcon\Crypt to encode URL-parameter-information that should not be visible to the public. Everything works just fine (using encryptBase64/decryptBase64), just one thing bugs me: Every time I encrypt a source-text, the encrypted value will be something else, e.g. encrypted the word "test" will have totally different encrypted values. Even though the DEcryption works all the time, the project requires to have unique URL-parameters to work for RSS-feeds and third-party applications. So, if the encrypted value is "12345" for the source-text "test", it should always be "12345" and not "23456" the next time I'm encrypting the source-text, so my URLs, containing the encrypted value, will stay the same and remain unique.

Is there a way to accomplish this? My idea for a workaround would be to cache all encrypted values and check if a value has been encrypted before encryption happens again and get the cached value from the database - but this seems way too much overhead for a (hopefully) simple issue.

I don't know, if this matters, but Crypt is written to the DI like this:

    function () use ($config) {
        $crypt = new Crypt();
        return $crypt;

Any hint is appreciated. Thanks, Dirk

Could you please post a small script that allow us to reproduce the issues?

edited Aug '15


$crypt = new Crypt();

The outcome are two different encrypted values, which can be decrypted to "text" all right, but I'd expect the encrypted values to be the same to be able to create unique URLs that don't change all the time.