- From: Paul Gearon <gearon@ieee.org>
- Date: Fri, 3 Dec 2010 18:04:40 -0500
- To: SPARQL Working Group <public-rdf-dawg@w3.org>
As discussed in the last teleconf, I would like to propose the include
of an "md5sum" function, in a similar fashion to MySQL.
MD5SUM is often used for storing passwords. SHA1SUM is used in a
similar way, and is also used for hashing email addresses in FOAF.
---
MD5SUM
The MD5SUM function accepts a single plain literal argument and
returns a simple literal containing a string of exactly 32 characters.
Each character represents a hexadecimal digit and is one of [0-9a-f].
The value returned from MD5SUM, is the result of applying the MD5
message-digest algorithm to the argument, as described in RFC 1321.
http://tools.ietf.org/html/rfc1321
Examples:
SELECT (MD5SUM('') AS ?m)
WHERE { }
?m
--
"d41d8cd98f00b204e9800998ecf8427e"
SELECT (MD5SUM('a') AS ?m)
WHERE { }
?m
--
"0cc175b9c0f1b6a831c399e269772661"
SELECT (MD5SUM('message digest') AS ?m)
WHERE { }
?r
--
"f96b697d7cb7938d525a2f31aaf161d0"
------
Also, since SHA1SUM is used in FOAF, it could be included in the same
way. SHA1 is defined at:
http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
Example code is provided at:
http://tools.ietf.org/html/rfc3174
SHA1SUM
The SHA1SUM function accepts a single plain literal argument and
returns a simple literal containing a string of exactly 32 characters.
Each character represents a hexadecimal digit and is one of [0-9a-f].
The value returned from SHA1SUM, is the result of applying the SHA-1
message-digest algorithm to the argument, as described in RFC 3174.
http://tools.ietf.org/html/rfc3174
Examples:
SELECT (SHA1SUM('') AS ?m)
WHERE { }
?m
--
"da39a3ee5e6b4b0d3255bfef95601890afd80709"
SELECT (SHA1SUM('abc') AS ?m)
WHERE { }
?m
--
"a9993e364706816aba3e25717850c26c9cd0d89d"
Regards,
Paul Gearon
Received on Friday, 3 December 2010 23:05:14 UTC