[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#894222: libghc-sha-dev: a gibberish in bytestringDigest



Dear Рома,

this is not a bug. SHA.bytestringDigest returns the digest in binary
format. If you hex-encode it, you get the usual textual representation:

Prelude> import qualified Data.ByteString.Lazy.Char8 as LBS
Prelude LBS>  import qualified Data.Digest.Pure.SHA as SHA
Prelude LBS SHA> let signature = SHA.hmacSha256 (LBS.pack "1") (LBS.pack "")
Prelude LBS SHA> signature
49f41477fa1bfc3b4792d5233b6a659f4bc1772692e9d5fe7db0624a300652eb
Prelude LBS SHA> SHA.showDigest signature
"49f41477fa1bfc3b4792d5233b6a659f4bc1772692e9d5fe7db0624a300652eb"
Prelude LBS SHA> let bs = SHA.bytestringDigest signature
Prelude LBS SHA> Data.ByteString.Base16.Lazy.encode bs
"49f41477fa1bfc3b4792d5233b6a659f4bc1772692e9d5fe7db0624a300652eb"


Cheers,
Joachim


Am Dienstag, den 27.03.2018, 20:55 +0700 schrieb Рома Тенцер:
> Package: libghc-sha-dev
> Version: 1.6.4.2-6+b1
> Severity: normal
> 
> When I use bytestringDigest i have a gibberish instead of proper 
> signature. I test it with hmacSha256, sha256 and sha512 with the same 
> result. showDigest works fine. An example is attached.
> 
> -- System Information:
> Debian Release: 9.4
>    APT prefers stable-updates
>    APT policy: (500, 'stable-updates'), (500, 'stable')
> Architecture: i386 (i686)
> 
> Kernel: Linux 4.9.0-6-686-pae (SMP w/1 CPU core)
> Locale: LANG=ru_RU.utf8, LC_CTYPE=ru_RU.utf8 (charmap=UTF-8), 
> LANGUAGE=ru_RU.utf8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> 
> Versions of packages libghc-sha-dev depends on:
> ii  ghc [libghc-bytestring-dev-0.10.8.1-3ddfb]  8.0.1-17+b1
> ii  libc6                                       2.24-11+deb9u3
> pn  libghc-array-dev-0.5.1.1-fa350              <none>
> pn  libghc-base-dev-4.9.0.0-1bac3               <none>
> pn  libghc-binary-dev-0.8.3.0-567c5             <none>
> ii  libgmp10                                    2:6.1.2+dfsg-1
> 
> libghc-sha-dev recommends no packages.
> 
> Versions of packages libghc-sha-dev suggests:
> ii  libghc-sha-doc   1.6.4.2-6
> pn  libghc-sha-prof  <none>
> 
> -- no debconf information
> 
> _______________________________________________
> Pkg-haskell-maintainers mailing list
> Pkg-haskell-maintainers@lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-haskell-maintainers
-- 
Joachim “nomeata” Breitner
Debian Developer
  nomeata@debian.org • https://people.debian.org/~nomeata
  XMPP: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F
  https://www.joachim-breitner.de/

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: