[gnutls-devel] Guile-GnuTLS | Missing zeros in digest/sha* output (#18)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Mon Aug 21 04:33:32 CEST 2023



Marius Bakke created an issue: https://gitlab.com/gnutls/guile/-/issues/18



Hi!

I wrote a simple sha256sum procedure:

```
(define (digest-sha256 str)
  (string-join
   (map (cut format #f "~x" <>)
        (bytevector->u8-list (hash-direct digest/sha256
                                          (string->utf8 str))))
   ""))
```

But:

```
(digest-sha256 "test")
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2bb822cd15d6c15b0f0a8
# echo -n test | sha256sum -
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
```

It seems there should be a 0 between `f0` and `a` at the end.  Is this a bug or am I doing something wrong?

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/guile/-/issues/18
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20230821/eca90ab9/attachment.html>


More information about the Gnutls-devel mailing list