haskell-hvr / cryptohash-sha1 Goto Github PK
View Code? Open in Web Editor NEWFast, pure and practical SHA1 implementation
Home Page: https://hackage.haskell.org/package/cryptohash-sha1
License: Other
Fast, pure and practical SHA1 implementation
Home Page: https://hackage.haskell.org/package/cryptohash-sha1
License: Other
Hello, would you accept a patch to export aliases for hash
, hashlazy
, hmac
, and hmaclazy
that indicate the hash function being used? My use case is simply, I prefer not using qualified imports :)
Something like
sha1 :: ByteString -> ByteString
sha1lazy :: ByteString -> ByteString
hmacSha1 :: ByteString -> ByteString -> ByteString
hmacSha1lazy :: ByteString -> ByteString -> ByteString
The latest release excludes base-4.15
. While a bounds bump seems sufficient to make the package compile, it might also be worth looking at other migration issues like https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0#withforeignptr.
The LICENSE file is BSD-3 but source files, sha1.c and sha1.h, have BSD-2 copyright headers. Can this be fixed and re-released?
Thanks.
Repo with minimal reproduction: https://github.com/fendor/cryptohash-sha1-min-repr
Code:
import qualified Crypto.Hash.SHA1 as H
main :: IO ()
main = (H.updates H.init ["hello", "world", "efewfwefwefwef", "ewfwefwefwef"]) `seq` putStrLn "Loaded"
Success:
cabal run exes
But executing:
cabal repl
> main
Produces this error:
Access violation in generated code when reading 0xffffffffffffffff
Attempting to reconstruct a stack trace...
Frame Code address
* 0x777dd30 0xf7912e0 C:\Users\Privat\AppData\Roaming\cabal\store\ghc-8.6.5\cryptohash-sh_-0.11.10_-bea6299b379c28bda524952b226e6787957d6614\lib\libHScryptohash-sh_-0.11.10_-bea6299b379c28bda524952b226e6787957d6614.a(sha1.o)+0x11b0
(hs_cryptohash_sha1_init+0x0)
* 0x777dd38 0xf780169 C:\Users\Privat\AppData\Roaming\cabal\store\ghc-8.6.5\cryptohash-sh_-0.11.10_-bea6299b379c28bda524952b226e6787957d6614\lib\libHScryptohash-sh_-0.11.10_-bea6299b379c28bda524952b226e6787957d6614.a(SHA1.o)+0x89
(cryptohashzmshzuzm0zi11zi10zuzmbea6299b379c28bda524952b226e6787957d6614_CryptoziHashziSHA1_init_info+0x67)
* 0x777dd40 0x4dae610
* 0x777dd48 0x7e244b8
cabal.exe: repl failed for exe:min-repr from min-repr-0.1.0.0. The build
process terminated with exit code 11
Didnt have time yet to test this behaviour with latest GHC.
EDIT:
Can not be reproduced on linux (nixos).
Shipping a fix for this warning would require a new release.
src/Crypto/Hash/SHA1.hs:133:19: warning: [GHC-68441] [-Wdeprecations]
In the use of ‘memcpy’
(imported from Data.ByteString.Internal, but defined in Data.ByteString.Internal.Type):
Deprecated: "Use Foreign.Marshal.Utils.copyBytes instead"
|
133 | copyCtx dst src = memcpy (castPtr dst) (castPtr src) (fromIntegral sizeCtx)
| ^^^^^^
Lifted from:
Just the library builds fine on master
.
To get build with tests and benchmarks started (as stated in cabal.project
), try:
$ cabal build --allow-newer=cereal:base \
--allow-newer=vector-th-unbox:base --allow-newer=vector-th-unbox:template-haskell \
--allow-newer=microstache:base \
--allow-newer=cassava:base \
--allow-newer=aeson:{ghc-prim,template-haskell} \
--allow-newer=hsc2hs:base
However, this fails on at least:
Seems like the bounds reject the base from GHC-9.6:
[__5] rejecting: binary-0.8.9.1/installed-0.8.9.1 (conflict: cryptohash-sha1
=> base>=4.5 && <4.18, binary => base==4.18.0.0/installed-4.18.0.0)
Allow-newer seems to work so maybe a revision is sufficient.
Would be nice to also cover cryptohash-md5.
GHC 9.4 is out now, and this library would build with it, but it doesn't because of the base bound.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.