Github user jpeach commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/681#discussion_r65223667 --- Diff: doc/admin-guide/plugins/ts_lua.en.rst --- @@ -2107,6 +2107,85 @@ Here is an example: bin = ts.sha1_bin(uri) end +`TOP <#ts-lua-plugin>`_ + +ts.sha256 +------- +**syntax:** *digest = ts.sha256(str)* + +**context:** global + +**description:** Returns the hexadecimal representation of the SHA256 digest of the ``str`` argument. + +Here is an example: + +:: + + function do_remap() + uri = ts.client_request.get_uri() + print(uri) -- /foo + print(ts.sha256(uri)) -- 6f64c6e6261f492ac220b0a4cd9a14c6373181b92a4a8040c1fcde5db31ffc94 + end + + +`TOP <#ts-lua-plugin>`_ + +ts.sha256_bin +----------- +**syntax:** *digest = ts.sha256_bin(str)* + +**context:** global + +**description:** Returns the binary form of the SHA256 digest of the ``str`` argument. + +Here is an example: + +:: + + function do_remap() + uri = ts.client_request.get_uri() + bin = ts.sha256_bin(uri) + end + +`TOP <#ts-lua-plugin>`_ + +ts.sha512 +------- +**syntax:** *digest = ts.sha512(str)* --- End diff -- I think a better syntax might be to explicitly pass a parameter to specify the result format, eg, ``RAW``, ``HEX``, ``BASE64``.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---