Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #257632

Re: sha256sum --text generating blank spaces and hyphens?

From Dan Ritter <dsr@randomstring.org>
Newsgroups linux.debian.user
Subject Re: sha256sum --text generating blank spaces and hyphens?
Date 2023-04-26 17:10 +0200
Message-ID <GoOWl-4Gkd-7@gated-at.bofh.it> (permalink)
References <GoI4y-4BMS-5@gated-at.bofh.it> <GoI4y-4BMS-3@gated-at.bofh.it> <GoIxz-4CcH-1@gated-at.bofh.it> <GoOtj-4FTJ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Albretch Mueller wrote: 
> On 4/26/23, Andy Smith <andy@strugglers.net> wrote:
> > If you're referring to the space and then the file name ("-" in case
> > of stdin) on the end, you can just select only the first output up
> > to whitespace with e.g. awk:
> >
> >     _SHA256=$(printf '%s' "${_TXT}" | sha256sum | awk '{print $1}')
> 
>  Yes, you could but I am trying to find out why this is happening
> instead of truncating the string when a space appears because I don't
> think what would be safe.

The white space and the - are not part of the sha256, they are
emitted by sha256sum as a courtesy. You can safely remove
everything starting with the first whitespace.

> >> // __ $_SHA256:
> >> |7d5895cb24ab49692a8ad495e036074fec8e61b22040544f02a9b69c926dbdeb  -|
> >
> > I only see harmless hexadecimal chars there.
> >
> >>  I am trying to avoid funky characters and sha256sum --text still
> >> generates them!?!
> >
> > Where are there "funky chars"?
> 
>  This is the first time I have seen blank spaces and hyphens in a text
> segment's sum. Those characters might be confusing.

The white space and the - are not part of the sha256, they are
emitted by sha256sum as a courtesy. You can safely remove
everything starting with the first whitespace.

>  Why is that happening? How could it be avoided? COuld you set the
> characters used in the representation of a sum?

The white space and the - are not part of the sha256, they are
emitted by sha256sum as a courtesy. You can safely remove
everything starting with the first whitespace.

The only characters used in the sha256 hash itself are [a-f] and
[0-9]

-dsr-

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

sha256sum --text generating blank spaces and hyphens? Albretch Mueller <lbrtchx@gmail.com> - 2023-04-26 09:50 +0200
  Re: sha256sum --text generating blank spaces and hyphens? <tomas@tuxteam.de> - 2023-04-26 10:20 +0200
    Re: sha256sum --text generating blank spaces and hyphens? Albretch Mueller <lbrtchx@gmail.com> - 2023-04-26 16:40 +0200
      Re: sha256sum --text generating blank spaces and hyphens? Nicolas George <george@nsup.org> - 2023-04-26 16:50 +0200
        Re: sha256sum --text generating blank spaces and hyphens? Max Nikulin <manikulin@gmail.com> - 2023-04-28 04:30 +0200
          Re: sha256sum --text generating blank spaces and hyphens? Nicolas George <george@nsup.org> - 2023-04-28 10:10 +0200
            Re: sha256sum --text generating blank spaces and hyphens? Max Nikulin <manikulin@gmail.com> - 2023-04-28 18:50 +0200
              Re: sha256sum --text generating blank spaces and hyphens? Nicolas George <george@nsup.org> - 2023-04-29 11:00 +0200
                Re: sha256sum --text generating blank spaces and hyphens? Max Nikulin <manikulin@gmail.com> - 2023-04-29 14:20 +0200
                Re: sha256sum --text generating blank spaces and hyphens? Nicolas George <george@nsup.org> - 2023-04-29 14:30 +0200
      Re: sha256sum --text generating blank spaces and hyphens? Dan Ritter <dsr@randomstring.org> - 2023-04-26 17:10 +0200
      Re: sha256sum --text generating blank spaces and hyphens? David Wright <deblis@lionunicorn.co.uk> - 2023-04-26 17:10 +0200
      Re: sha256sum --text generating blank spaces and hyphens? "Thomas Schmitt" <scdbackup@gmx.net> - 2023-04-26 17:10 +0200
      Re: sha256sum --text generating blank spaces and hyphens? <tomas@tuxteam.de> - 2023-04-26 19:00 +0200
        Re: sha256sum --text generating blank spaces and hyphens? Albretch Mueller <lbrtchx@gmail.com> - 2023-04-26 22:40 +0200
          Re: sha256sum --text generating blank spaces and hyphens? Albretch Mueller <lbrtchx@gmail.com> - 2023-04-26 23:10 +0200
          Re: sha256sum --text generating blank spaces and hyphens? Andy Smith <andy@strugglers.net> - 2023-04-26 23:50 +0200
  Re: sha256sum --text generating blank spaces and hyphens? Andy Smith <andy@strugglers.net> - 2023-04-26 12:50 +0200
  Re: sha256sum --text generating blank spaces and hyphens? Jeffrey Walton <noloader@gmail.com> - 2023-04-26 18:00 +0200
  Re: sha256sum --text generating blank spaces and hyphens? David Christensen <dpchrist@holgerdanske.com> - 2023-04-27 00:50 +0200
    Re: sha256sum --text generating blank spaces and hyphens? Nicolas George <george@nsup.org> - 2023-04-27 00:50 +0200
      Re: sha256sum --text generating blank spaces and hyphens? David Christensen <dpchrist@holgerdanske.com> - 2023-04-27 06:10 +0200
        Re: sha256sum --text generating blank spaces and hyphens? Max Nikulin <manikulin@gmail.com> - 2023-04-27 08:00 +0200
          Re: sha256sum --text generating blank spaces and hyphens? Albretch Mueller <lbrtchx@gmail.com> - 2023-04-27 09:30 +0200
        Re: sha256sum --text generating blank spaces and hyphens? Nicolas George <george@nsup.org> - 2023-04-27 10:10 +0200
          Re: sha256sum --text generating blank spaces and hyphens? David Christensen <dpchrist@holgerdanske.com> - 2023-04-27 17:20 +0200
            Re: sha256sum --text generating blank spaces and hyphens? Albretch Mueller <lbrtchx@gmail.com> - 2023-05-02 02:10 +0200
    Re: sha256sum --text generating blank spaces and hyphens? Albretch Mueller <lbrtchx@gmail.com> - 2023-04-27 01:30 +0200
      Re: sha256sum --text generating blank spaces and hyphens? David Christensen <dpchrist@holgerdanske.com> - 2023-04-27 06:30 +0200

csiph-web