Editors should exploit Hashes

Editors of any kind are usually aware that a file has been changed and must be saved to disk before quitting the editor. On some occasions, this does not make sense. And it is so easy to avoid...

All that an editor should do is calculate the hash of a document at any time it is synchronised with the disk, that is, when it is read from or has been written to disk.

Before quitting, the editor should not look at a flag that indicates whether any editing action has taken place, but it should quickly calculate the hash of the document, and suggest saving it only when the content has indeed been changed -- that is, when the hash differs from the disk-synchronous hash value.

This makes sense to humans. How often don't we start editing, use undo or manually reverse our own work, and then get annoyed by the question whether we really want to quit without saving.

A good hash to use for this purpose is MD4. It is widely implemented, it is faster than MD5 and SHA1 and only less secure. Note that security is not an issue here; someone operating an editor is not interested in torpeding his own work. Meaning, trust matters are no concern here, only the chance that the hash outcome will be the same on a document before and after editing. And those chances are dramatically low.

Posted on Sun, 10 Apr 2005, 13:55.


 
   ------ 8< ---------- 8< ----------- 8< ------ | OpenFortress*