Please provide a method on descriptors for calculating digests
All throughout documents available through dir-spec there are SHA1 and SHA256 digests to reference other documents. It's easy enough to follow these but if you already have the document but want to get its digest, I can't see the method for doing so.
This would ideally return a lower-case SHA1 hex digest, or a base64 encoded SHA256 digest, depending on which function you call.