Also, in your opinion, is it best to store the hash as a string or in its original binary form in a database for later comparison?

It depends on the specifics of your database and your application (you are free to choose the format that is more suitable for using within your application). From security point of view, there's no difference between storing hash value in either binary or ASCII form.

With regard to the second question about db storage, it's not a matter of security but of verification.

Basically I am storing the original file's hash before timestamping the file and then the hash after timestamping to use as proof of a document's state at a certain point in time. i.e. to prove that no changes have been made to the document since timestamping. I just needed to know whether it was best to store the original binary data or a conversion to string.

Well, in both cases the same value is kept (in different encodings though). Actually, an encoded string requires twice more place than a binary digest value (as each binary byte is replaced with two ASCII characters). If you do not need the values stored in database to be human-readable, storing binary-encoded digests will be a more effective approach.

We use cookies to help provide you with the best possible online experience. By using this site, you agree that we may store and access cookies on your device. You can find out more about and set your own preferences here.