Skip to article frontmatterSkip to article content
Template function

SHA512

When you need an hash that is often longer than the original value 🀣

The sha512 function provides an easy way to calculate the SHA512 hash of a given value.

Template function properties
FunctionCalculate the SHA512 hash of a given value
Function namesha512
ReturnsThe SHA512 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
sha512(
    value: str
) -> str
Function parameters
AttributeTypeRequiredDefault / Example
valuestringYeshash me

ExamplesΒΆ

Using sha512 as a functionΒΆ

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

Returns:

a4e696753b7051ad155897857e3c953ea1aec14701a93a23fc3a8d89c874e21edec7d0f7360ce03cb5c82df2b4a8a7ff40c6a475a52a59ee13912d217e72cb91

Using sha512 as a filterΒΆ

1
{{ "hash me" | sha512 }}

Returns:

a4e696753b7051ad155897857e3c953ea1aec14701a93a23fc3a8d89c874e21edec7d0f7360ce03cb5c82df2b4a8a7ff40c6a475a52a59ee13912d217e72cb91

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.