aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src/Text
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2024-09-29 18:32:12 +0200
committerAlbert Krewinkel <[email protected]>2024-09-29 18:36:56 +0200
commit7565a90cec79c5fcd1d3b3e5ddb042d2cdaccac3 (patch)
treef48f1ff5d8c87092990c97ff4b9aa068501304c7 /pandoc-lua-engine/src/Text
parent7a96b253c205a1cf5dad862a46e29f0183d36cc7 (diff)
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.
Diffstat (limited to 'pandoc-lua-engine/src/Text')
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Module/Utils.hs7
1 files changed, 3 insertions, 4 deletions
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."