diff options
Diffstat (limited to 'source/hash.d')
| -rw-r--r-- | source/hash.d | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/hash.d b/source/hash.d new file mode 100644 index 0000000..3071fa3 --- /dev/null +++ b/source/hash.d @@ -0,0 +1,13 @@ +module brpaste.hash; + +pure string hash(T)(T data) { + import std.base64; + import std.digest.murmurhash; + auto hash = digest!(MurmurHash3!32)(data); + return Base64URLNoPadding.encode(hash); +} + +pure string hash(T : string)(T data) { + import std.string; + return hash(data.representation); +} |
