Using SHA1 hash of blob as database key

This PR is *highly* experimental.

Instead of using the standard numerical key system, this patch uses the SHA1 hash of the blob object to be saved as the key.

Downside: it might not be possible to generate a SHA1 hash of a binary blob object.