From 7565a90cec79c5fcd1d3b3e5ddb042d2cdaccac3 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Sun, 29 Sep 2024 18:32:12 +0200 Subject: Stop depending on package SHA Pandoc already depends on `crypton-conntection`, and thus transitively on `crypton`. The latter provides a vast variety of hashing algorithms and makes the dependency on SHA unnecessary. --- pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pandoc-lua-engine/src/Text') diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs index 8bd04b72b..325f09258 100644 --- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs +++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs @@ -19,6 +19,7 @@ module Text.Pandoc.Lua.Module.Utils import Control.Applicative ((<|>)) import Control.Monad ((<$!>)) +import Crypto.Hash (hashWith, SHA1(SHA1)) import Data.Data (showConstr, toConstr) import Data.Default (def) import Data.Maybe (fromMaybe) @@ -34,8 +35,6 @@ import Text.Pandoc.Lua.Marshal.AST import Text.Pandoc.Lua.Marshal.Reference import Text.Pandoc.Lua.PandocLua (PandocLua (unPandocLua)) -import qualified Data.Digest.Pure.SHA as SHA -import qualified Data.ByteString.Lazy as BSL import qualified Data.Map as Map import qualified Data.Text as T import qualified Text.Pandoc.Builder as B @@ -301,8 +300,8 @@ run_json_filter = defun "run_json_filter" -- | Documented Lua function to compute the hash of a string. sha1 :: DocumentedFunction e sha1 = defun "sha1" - ### liftPure (SHA.showDigest . SHA.sha1) - <#> parameter (fmap BSL.fromStrict . peekByteString) "string" "input" "" + ### liftPure (show . hashWith SHA1) + <#> parameter peekByteString "string" "input" "" =#> functionResult pushString "string" "hexadecimal hash value" #? "Computes the SHA1 hash of the given string input." -- cgit v1.2.3