Skip to content

Instantly share code, notes, and snippets.

@sebduggan
Created October 30, 2017 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebduggan/10e5e97aee44e28221fced6e775ae8bf to your computer and use it in GitHub Desktop.
Save sebduggan/10e5e97aee44e28221fced6e775ae8bf to your computer and use it in GitHub Desktop.
HMAC encode function for FoxyCart
<cffunction name="hmacEncode" returntype="string" output="false">
<cfargument name="sku" required="true" />
<cfargument name="name" required="true" />
<cfargument name="value" required="true" />
<cfset var stringToHash = arguments.sku & arguments.name & arguments.value />
<cfset var apiKey = "YOUR_API_KEY_HERE" />
<cfset var hashedString = hmac( stringToHash, apiKey, "HMACSHA256" ) />
<cfreturn lcase( hashedString ) />
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment