The sha256 function provides an easy way to calculate the SHA256 hash of a given value.
Template function properties | |
---|---|
Function | Calculate the SHA256 hash of a given value |
Function name | sha256 |
Returns | The SHA256 hash |
Return type | string |
Can be used as a filter | Yes |
Can be used as a test | No |
Spook's influence | Newly added template function |
Developer tools | Try this in the template developer tools |
Signature |
---|
|
Function parameters | |||
---|---|---|---|
Attribute | Type | Required | Default / Example |
value | string | Yes | hash me |
ExamplesΒΆ
Using sha256 as a functionΒΆ
1
{{ sha256("hash me") }}
Returns:
8f6eb3e24a721e7a17ccb91c0f7fb264c00261034a560a31bfae200599b7331b
Using sha256 as a filterΒΆ
1
{{ "hash me" | sha256 }}
Returns:
8f6eb3e24a721e7a17ccb91c0f7fb264c00261034a560a31bfae200599b7331b
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.