hmac - Liquid Filter Reference - 0.11.6
Filter Name | hmac |
Group | Text |
Version | 0.11.6 |
Description
Converts a string into an encrypted hash using a hash message authentication code (HMAC).
Examples
When no options are specified, it uses the SHA1 algorithm and returns a binary digest:
{{ "String to Hash" | hmac: "secret key" }}
?̻*&??q3Wc?5W?,?
When an invalid algorithm is specified, it returns an empty string:
{{ "String to Hash" | hmac: "secret key", algorithm: "FAKE" }}
Options
algorithm
Specifies the algorithm to use for the HMAC. The default is SHA1. Options are SHA, SHA1, SHA224, SHA256, SHA384, SHA512, MD5, and RIPEMD160.}
When the SHA1 algorithm is specified, it uses the SHA1 algorithm:
{{ "String to Hash" | hmac: "secret key", algorithm: "SHA1" }}
?̻*&??q3Wc?5W?,?
When the SHA224 algorithm is specified, it uses the SHA224 algorithm:
{{ "String to Hash" | hmac: "secret key", algorithm: "SHA224" }}
??LDQS??UX?R?0]?????Jw?ǰ
When the SHA256 algorithm is specified, it uses the SHA256 algorithm:
{{ "String to Hash" | hmac: "secret key", algorithm: "SHA256" }}
?EPT?o_5yo.?J??sw????P??0Ct{??
When the SHA384 algorithm is specified, it uses the SHA384 algorithm:
{{ "String to Hash" | hmac: "secret key", algorithm: "SHA384" }}
????\??GuŇA?S??????ܰ????F-$|E????0??Rx
When the SHA512 algorithm is specified, it uses the SHA512 algorithm:
{{ "String to Hash" | hmac: "secret key", algorithm: "SHA512" }}
??*?ue[3
?D-?Q???? \a0+aՖ???'Y?E㓁?????;]?0??؝??*?4Rj?h
When the MD5 algorithm is specified, it uses the MD5 algorithm:
{{ "String to Hash" | hmac: "secret key", algorithm: "MD5" }}
???ؽ?k?\???ҁ?
When the RIPEMD160 algorithm is specified, it uses the RIPEMD160 algorithm:
{{ "String to Hash" | hmac: "secret key", algorithm: "RIPEMD160" }}
6???UK?B?W??N??!e
digest
Specifies the digest format to use to use for the HMAC. The default is Binary. Options are Hex, Base64, and Binary.
When the Binary digest is specified, it returns a binary digest:
{{ "String to Hash" | hmac: "secret key", digest: "Binary" }}
?̻*&??q3Wc?5W?,?
When the Hex digest is specified, it returns a hex digest:
{{ "String to Hash" | hmac: "secret key", digest: "Hex" }}
3fccbb2a2682817133576387047f3557f22c8f0d
When the Base64 digest is specified, it returns a base64 digest:
{{ "String to Hash" | hmac: "secret key", digest: "Base64" }}
P8y7KiaCgXEzV2OHBH81V/Isjw0=
Back to Liquid Reference for 0.11.6
Back to Documentation