Skip to article frontmatterSkip to article content
Template function

SHA256

Sjaakie's Hashing Algorithm 256 🀣

The sha256 function provides an easy way to calculate the SHA256 hash of a given value.

Template function properties
FunctionCalculate the SHA256 hash of a given value
Function namesha256
ReturnsThe SHA256 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
sha256(
    value: str
) -> str
Function parameters
AttributeTypeRequiredDefault / Example
valuestringYeshash 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.