[redland-dev] Possible APIs for content digest support in redland
Dave Beckett
dave.beckett at bristol.ac.uk
Tue Nov 16 19:27:12 GMT 2004
I was asked off list about content digest support in redland, and
they didn't know that Redland ships with SHA1, MD5 and RIPEMD160 in
all releases. It's used internally for the mysql store but not
exposed in the user level API.
I've not done this so-far since I wasn't sure how to express it best.
The main application where this is handy is for the FOAFy *sha1sum
type properties when you want to create an ASCIIfied SHA1 digest of
an email address or other string, in order to make a value.
So at the user API the alternatives could be :
#1
a general digest function to make a sha1 digest
string getSHA1(string s)
returning the ASCIIfied SHA1 digest of the string s
#2
or a general checker function:
bool matchesSHA1(string s, string digest)
returning TRUE if SHA1(string s) matches the SHA1 digest in
ASCIIfied digest
#3
or node methods:
bool node.matchesDigest(digest, "sha1")
string node.getDigest("sha1")
#4
or specific node ones:
bool node.matchesSHA1(digest)
string node.getSHA1(node)
I guess my preference is for #3 alone. Comments?
Dave
More information about the redland-dev
mailing list