[NTG-context] hash for buffer contents
Max Chernoff
mseven at telus.net
Thu Sep 22 00:26:34 CEST 2022
Hi Pablo,
> Is there any way to get "utilities.sha2.hash512" with the contents of
> the "abc" buffer?
You can use "buffers.getcontent" or "buffers.raw":
\startbuffer[test]
One
Two
Three
\stopbuffer[test]
\starttext
\startluacode
require("util-sha")
local content = buffers.getcontent("test")
-- local content = buffers.raw("test") -- same result
local sha512 = utilities.sha2.hash512(content)
context(sha512)
\stopluacode
\stoptext
Depending on what you're trying to do, the "filter" module may be
helpful here.
-- Max
More information about the ntg-context
mailing list