Skip to article frontmatterSkip to article content
Template function

SHA1

Insecure, useless, still used a darn lot πŸ™ˆ

The sha1 function provides an easy way to calculate the SHA1 hash of a given value.

Template function properties
FunctionCalculate the SHA1 hash of a given value
Function namesha1
ReturnsThe SHA1 hash
Return typestring
Can be used as a filterYes
Can be used as a testNo
Spook's influenceNewly added template function
Developer toolsTry this in the template developer tools
Signature
sha1(
    value: str
) -> str
Function parameters
AttributeTypeRequiredDefault / Example
valuestringYeshash me

ExamplesΒΆ

Using sha1 as a functionΒΆ

1
{{ sha1("hash me") }}

Returns:

3bd28babb1ea84fd20da6ff3abcc0791613d38d2

Using sha1 as a filterΒΆ

1
{{ "hash me" | sha1 }}

Returns:

3bd28babb1ea84fd20da6ff3abcc0791613d38d2

Features requests, ideas, and supportΒΆ

If you have an idea on how to further enhance the Home Assistant template engine, for example, by adding a new template function; feel free to let us know in our discussion forums.

Are you stuck using this new feature? Or maybe you’ve run into a bug? Please check the Support page on where to go for help.