0
$\begingroup$

I am designing a secure vault, which stores tens of thousands of encrypted messages and authenticated with Fernet/HMAC, A user query the vault with a key, could I use some kind of index to tell if the key can be used to decrypt any of the stored messages?

Or do I have to try decrypt them one by one?

$\endgroup$

2 Answers 2

1
$\begingroup$

Found a stupidly simple solution: Create an index of md5(key).

Alternatively, replace md5 with hash method of your choice.

$\endgroup$
-1
$\begingroup$

That design is essentially the reverse of brutal-forcing a cipher key: you are brutal-forcing a key with messages, the time required grows linearly to the size of the vault.

You really should devise a more efficient seeking method.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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