Can a file encrypted with a hashing algorithm (like SHA-256) be equally secure as a symmetrical algorithm (like AES)?
This is how it could be done using a password (this is the most simple example, please don't suggest optimizations, it's just the concept):
- Generate random looking binary data of the same length as the file contents, using
- XOR the file contents with the data generated above
- Store the result (the encrypted file) as the seed, followed by the XOR'ed data from above. The length of the encrypted file is (seed size + original file length).
The seed of course needs to be unique for every new file (like a GUID)
The question is not about how safe SHA-256 or AES is, or how safe a password is. Just assume we have a perfect hashing algorithm, a perfect symmetrical algorithm and a perfect password.
The question is why the encryption described above would be easier to break as the symmetrical algorithm.
data + SHA256(...)after explaining that
+is concatenation, but it is unclear what
datais supposed to be. As it currently stands, the encryption routine is not well defined. $\endgroup$