问题
I have a file shredder on my computer, and I wanted to know if it's possible to make one in JAVA just for learning sake. But, I'm not sure how exactly it works, so this is what I think it does, please correct me where I'm wrong.
So basically it keeps encrypting the bytes of the file, and then simply deletes it. But that seems too easy to me, so I must be missing something or be completely wrong. I've looked up how it works, but I always just get software advertisements.
Thanks for any response
回答1:
Overwriting will solve the problem but it depends on the filesystem/platform (see the comment below). Here's a related question with .NET (not so much different than Java) Shredding files in .NET
回答2:
Please note that shredding is very much filesystem and media dependent. Attempting to "shred" a file on a log based filesystem or a filesystem stored on smart (write leveling) flash isn't going to get you very far. You would have to, at a minimum, write enough data to complete fill the device to hope that the old data might be overwritten one time. More likely you would have to write several smaller files and when you get FS full, delete one and then keep writing a new one, to ensure that all reserved space has been overwritten as well. Then you will probably be fairly safe. Probably.
I say probably because the storage media/FS could decide that a block was failing (or used too much relatively) and map it away substituting some other part of the disk instead. This is a per-block thing of course, so any much larger file is unlikely to be reconstructed.
回答3:
At minimum, a software file shredder must write 0s into the physical media that used to hold the file.
回答4:
What you can do is get the bites from the file one by one, set them to 0 and send them into oblivion aka trash :)
来源:https://stackoverflow.com/questions/6240266/file-shredding-concept-question