HACKERALERT / Picocrypt

A very small, very simple, yet very secure encryption tool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Picocrypt Recursive option derives the key for each file

Asudox opened this issue · comments

commented

I noticed a problem with the current recursive feature.
Picocrypt derives the key for each file that it finds, this makes the encryption process slower.
So maybe you could add a variable to check if the key was derived already and use it if it was. I believe this will make the recursive encryption process faster.

No, this is intentional because reusing the same encryption key is not ideal. Each time a file is encrypted, an encryption key is derived from the password using Argon2 and a random salt. This random salt means that each file will have a different encryption key and the output will be different each time. This makes the output non-deterministic, which is a good property to have in terms of security.

commented

No, this is intentional because reusing the same encryption key is not ideal. Each time a file is encrypted, an encryption key is derived from the password using Argon2 and a random salt. This random salt means that each file will have a different encryption key and the output will be different each time. This makes the output non-deterministic, which is a good property to have in terms of security.

Oh, I see.

No, this is intentional because reusing the same encryption key is not ideal. Each time a file is encrypted, an encryption key is derived from the password using Argon2 and a random salt. This random salt means that each file will have a different encryption key and the output will be different each time. This makes the output non-deterministic, which is a good property to have in terms of security.

@HACKERALERT

But running the whole Argon2 process again is nonsense. You can just hash the output of Argon2 again (with SHA3-256 or Blake2b for example) together with the Salt to derive a new key. That is proven to be secure and therefore being used in applications like VeraCrypt and Cryptomator which are both audited by Cure53.

@BigPanda97
Say you encrypt 100 files in this manner. Then the 100th file's encryption key is the Argon2 of the password hashed by SHA3 99 times. Since each of those 99 times, the new key is created by hashing the previous key with a salt that is stored in a previous volume, once you delete the first 99 files, you can no longer derive the key to the 100th file. Chaining encryption like this is unreliable and adds unnecessary complexity. The point of the recursive feature is not to be fast, but to be correct and reliable. All it does is do everything a user normally would, but for a large batch of files at once. There should be no new format or scheme used. If the repeated Argon2 is a problem, then perhaps you shouldn't be using Picocrypt for your use case in the first place :)