Foaf with hex encoded SHA1 mailbox
The Foaf mbox_sha1sum element is an email address with the "mailto:" appended to it. Btw, it is not just the digest result, nor is it the result encoded as Base64, but it is Hex encoded (doesn't state the Hex part as the element definition, although i subsequently found it in another element definition).
public
static string CreateHexSHA1Sum(string email)
{
SHA1Managed hash = new SHA1Managed();
byte[] digest = hash.ComputeHash(Encoding.Default.GetBytes(email));
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (byte b in digest)
sb.Append(b.ToString("x2"));
return(sb.ToString());
}
In goes someemail@venturetogetherspam.com and out comes 23f728c05bcf6e68eae7f51243ebc805d0d819c5 so we have :
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<foaf:Person>
<foaf:name>Steven Livingstone</foaf:name>
<foaf:mbox_sha1sum>23f728c05bcf6e68eae7f51243ebc805d0d819c5</foaf:mbox_sha1sum>
</foaf:Person>
</rdf:RDF>
vtgo.net