local crypto = require('crypto') local print = ngx.say local hmacdigest = crypto.hmac.digest local base64 = ngx.encode_base64 local headers = ngx.req.get_headers() ngx.header.content_type = 'text/plain'; for k, v in pairs(headers) do print(string.format("%s\t%s: %s", base64(hmacdigest('sha256', v, k, true)), k, v)) end