[
https://issues.apache.org/jira/browse/TS-4491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15308138#comment-15308138
]
ASF GitHub Bot commented on TS-4491:
------------------------------------
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``.
> support sha256/sha512 in ts_lua plugin
> --------------------------------------
>
> Key: TS-4491
> URL: https://issues.apache.org/jira/browse/TS-4491
> Project: Traffic Server
> Issue Type: Improvement
> Components: Lua, Plugins
> Reporter: Kit Chan
> Assignee: Kit Chan
> Fix For: 7.0.0
>
>
> support sha256 and sha512 hash functions in ts_lua plugin
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)