I want to find an crypt algorithm which provides the functionality described below.

Given a key (a vector Vkey) and a data (an image), use this key to encry the image; the encrypted image can not be identified afetr encrypt.

When decrypt, if:

  1. use a key = Vkey to decrypt, the decoded image is the same as original one without error.
  2. use a key = Vkey_1, and diff(Vkey, Vkey_1) < threashold, the decoded image has slightly diffence (ex, for each pixel 1~5 difference) with original.
  3. use a key = Vkey_2 which is much unlike Vkey (diff(Vkey, Vkey_1) > threashold), the decoded image is far from clear as orignal.

In short, diff(Vkey, Vkey_try) is Proportional to diff(original, decrypted image).

Some crypt algorithm requests that the decrypt key should be exactly the same as the key but here, we need "if not completely match but only slightly different, we still can decode but with a little artifact".

Is there any similiar en(de)crypt algorithm which provides the requested functionality?

1

There are 1 best solutions below

0
On

There is no cryptographically secure algorithm that satisfies 2. When you use a cryptographically secure algorithm, the data is indistinguishable from random without the correct key. Therefore, if you use a different key to decrypt, the data should be completely randomized.

There are algorithms where related keys can produce similar encryption, such as RC4, but this is considered a major security problem, and as a consequence RC4 is forbidden in TLS and other secure protocols. The output is also not similar enough to meet your goals.

If your goal is to do something other than securely encrypting your data (as suggested by your tag "demosaicing"), it would help if you mentioned what that goal was so we could provide a helpful response to help you accomplish that goal. For example, if your goal is to produce similar images that differ only slightly but you don't need cryptographic security, there are algorithms to do that which might meet your needs.