best_tags.hash

best_tags.hash(algorithm, str)

Return a hexadecimal md5 digest of a string

First argument is a string giving the hash algorithm, for example: “md5”, “sha1” … Second argument is the string or variable to hash

Note

string are encoded to utf-8 prior calculating the hash

Example

>>> c = {'title':'My worderful document title'}
>>> t = '{% load best_tags %}{% hash "md5" title %}'
>>> Template(t).render(Context(c))
'3ddbd7936634a6a47f978376674dea31'