1
$\begingroup$

I am using a cryptography library for Python and it provides Fernet Module.

Now I have a plaintext to encrypt. It produces a ciphertext. Then I try to encrypt the same plaintext with the same key but the ciphertexts are different.

I need the ciphertext to be the same every time. Do you know any way around this? Or maybe a different encryption technique? Thanks in advance

$\endgroup$
  • 1
    $\begingroup$ Why do you need the ciphertext to be the same every time? Deterministic ciphertexts fail to satisfy the typical security goal for confidentiality, which is indistinguishability. $\endgroup$ – Ella Rose Jun 15 at 13:30
  • 1
    $\begingroup$ I am working on an experimental database. It's just a project that I run in my free time. Check it out: ipds.network/IPDS.pdf $\endgroup$ – A. Szokalski Jun 15 at 20:50
  • $\begingroup$ Any reason you don't just page down the Python docs to THE HAZARDOUS MATERIALS LAYER? You might be able to use types authenticated encryption with fixed IVs (careful), or failing that, simply AES-some-mode-thing. Do you have any authentication issues in space? $\endgroup$ – Paul Uszak Jun 16 at 21:15
1
$\begingroup$

It sounds like what you want is a deterministic authenticated cipher, or DAE, deterministic authenticated encryption, which has the property that an adversary can always tell when you have repeated messages, of course.

As far as I can tell, Fernet does not support any DAE. Popular choices for DAE include SIV-type schemes like AES-SIV. But you should have a good reason for using DAE first! Most applications don't need it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.