Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"There is hopeful symbolism in the fact that flags do not wave in a vacuum." -- Arthur C. Clarke


devel / comp.unix.shell / Re: The same string will generate different md5sums by python and md5sum tool.

SubjectAuthor
* Re: The same string will generate different md5sums by python and md5sum tool.Ben Bacarisse
`* Re: The same string will generate different md5sums by python andhongy...@gmail.com
 +* Re: The same string will generate different md5sums by python andhongy...@gmail.com
 |`* Re: The same string will generate different md5sums by python andhongy...@gmail.com
 | +* Re: The same string will generate different md5sums by python andWilliam Unruh
 | |`- Re: The same string will generate different md5sums by python andhongy...@gmail.com
 | `* Re: The same string will generate different md5sums by python andEd Morton
 |  `* Re: The same string will generate different md5sums by python and md5sum tool.Helmut Waitzmann
 |   `- Re: The same string will generate different md5sums by python andhongy...@gmail.com
 +* Re: The same string will generate different md5sums by python andDavid W. Hodgins
 |`* Re: The same string will generate different md5sums by python andGeoff Clare
 | `- Re: The same string will generate different md5sums by python andhongy...@gmail.com
 `- Re: The same string will generate different md5sums by python andChristian Weisgerber

1
Re: The same string will generate different md5sums by python and md5sum tool.

<878ryybkuz.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4472&group=comp.unix.shell#4472

 copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: The same string will generate different md5sums by python and md5sum tool.
Date: Tue, 12 Oct 2021 11:25:40 +0100
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <878ryybkuz.fsf@bsb.me.uk>
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="7e918d3f9851aada2211800d78423c72";
logging-data="2718"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18B3VaCQEycDiLHTExIq8ueBbW5l5MIUnc="
Cancel-Lock: sha1:cMFHPW1xbHhIq80rvf3omm79LJw=
sha1:QZmCTa8T7CfLCB7PIXr6ppx2FV4=
X-BSB-Auth: 1.acff332397c9791f887d.20211012112540BST.878ryybkuz.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 12 Oct 2021 10:25 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:

> For short, as shown below:
>
> $ md5sum <<< 'TASCJO3RJMVKWDJKXLZM'
> e1b8fa8fe09c295811063bb76cefc337 -
>
> $ ipython
> In [1]: from hashlib import md5
>
> In [2]: my_str='TASCJO3RJMVKWDJKXLZM'
>
> In [3]: md5(my_str.encode('utf-8')).hexdigest()
> Out[3]: 'e9032994dabac08080091151380478a2'
>
> Any hints for this behavior?

>>> md5("TASCJO3RJMVKWDJKXLZM\n".encode('utf-8')).hexdigest()
'e1b8fa8fe09c295811063bb76cefc337'

--
Ben.

Re: The same string will generate different md5sums by python and md5sum tool.

<9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4473&group=comp.unix.shell#4473

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ad4:42c8:: with SMTP id f8mr29374924qvr.58.1634040236323;
Tue, 12 Oct 2021 05:03:56 -0700 (PDT)
X-Received: by 2002:a05:622a:1315:: with SMTP id v21mr7771482qtk.231.1634040236158;
Tue, 12 Oct 2021 05:03:56 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 12 Oct 2021 05:03:55 -0700 (PDT)
In-Reply-To: <878ryybkuz.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=54.180.6.193; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 54.180.6.193
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com> <878ryybkuz.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Tue, 12 Oct 2021 12:03:56 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 27
 by: hongy...@gmail.com - Tue, 12 Oct 2021 12:03 UTC

On Tuesday, October 12, 2021 at 6:25:43 PM UTC+8, Ben Bacarisse wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>
> > For short, as shown below:
> >
> > $ md5sum <<< 'TASCJO3RJMVKWDJKXLZM'
> > e1b8fa8fe09c295811063bb76cefc337 -
> >
> > $ ipython
> > In [1]: from hashlib import md5
> >
> > In [2]: my_str='TASCJO3RJMVKWDJKXLZM'
> >
> > In [3]: md5(my_str.encode('utf-8')).hexdigest()
> > Out[3]: 'e9032994dabac08080091151380478a2'
> >
> > Any hints for this behavior?
> >>> md5("TASCJO3RJMVKWDJKXLZM\n".encode('utf-8')).hexdigest()
> 'e1b8fa8fe09c295811063bb76cefc337'

Thank you for pointing this out. I confirmed it with the following command:

$ cat -A <<< 'TASCJO3RJMVKWDJKXLZM'
TASCJO3RJMVKWDJKXLZM$

But how to supply string for md5sum without '\n'?

HZ

Re: The same string will generate different md5sums by python and md5sum tool.

<ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4474&group=comp.unix.shell#4474

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a0c:c24c:: with SMTP id w12mr24494228qvh.48.1634041166043;
Tue, 12 Oct 2021 05:19:26 -0700 (PDT)
X-Received: by 2002:ac8:6b96:: with SMTP id z22mr21551131qts.311.1634041165908;
Tue, 12 Oct 2021 05:19:25 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 12 Oct 2021 05:19:25 -0700 (PDT)
In-Reply-To: <9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=60.249.28.128; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 60.249.28.128
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk> <9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com>
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Tue, 12 Oct 2021 12:19:26 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 32
 by: hongy...@gmail.com - Tue, 12 Oct 2021 12:19 UTC

On Tuesday, October 12, 2021 at 8:03:58 PM UTC+8, hongy...@gmail.com wrote:
> On Tuesday, October 12, 2021 at 6:25:43 PM UTC+8, Ben Bacarisse wrote:
> > "hongy...@gmail.com" <hongy...@gmail.com> writes:
> >
> > > For short, as shown below:
> > >
> > > $ md5sum <<< 'TASCJO3RJMVKWDJKXLZM'
> > > e1b8fa8fe09c295811063bb76cefc337 -
> > >
> > > $ ipython
> > > In [1]: from hashlib import md5
> > >
> > > In [2]: my_str='TASCJO3RJMVKWDJKXLZM'
> > >
> > > In [3]: md5(my_str.encode('utf-8')).hexdigest()
> > > Out[3]: 'e9032994dabac08080091151380478a2'
> > >
> > > Any hints for this behavior?
> > >>> md5("TASCJO3RJMVKWDJKXLZM\n".encode('utf-8')).hexdigest()
> > 'e1b8fa8fe09c295811063bb76cefc337'
> Thank you for pointing this out. I confirmed it with the following command:
>
> $ cat -A <<< 'TASCJO3RJMVKWDJKXLZM'
> TASCJO3RJMVKWDJKXLZM$
>
> But how to supply string for md5sum without '\n'?

I see. Here it is:

$ echo -n 'TASCJO3RJMVKWDJKXLZM' | md5sum
e9032994dabac08080091151380478a2 -

HZ

Re: The same string will generate different md5sums by python and md5sum tool.

<33e5eb0a-3d7d-48ca-8c16-a9d7c59540c4n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4475&group=comp.unix.shell#4475

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:180f:: with SMTP id t15mr21403894qtc.33.1634041260597;
Tue, 12 Oct 2021 05:21:00 -0700 (PDT)
X-Received: by 2002:ac8:5559:: with SMTP id o25mr22189930qtr.126.1634041260461;
Tue, 12 Oct 2021 05:21:00 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 12 Oct 2021 05:21:00 -0700 (PDT)
In-Reply-To: <ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=13.209.82.85; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 13.209.82.85
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk> <9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
<ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <33e5eb0a-3d7d-48ca-8c16-a9d7c59540c4n@googlegroups.com>
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Tue, 12 Oct 2021 12:21:00 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 34
 by: hongy...@gmail.com - Tue, 12 Oct 2021 12:21 UTC

On Tuesday, October 12, 2021 at 8:19:28 PM UTC+8, hongy...@gmail.com wrote:
> On Tuesday, October 12, 2021 at 8:03:58 PM UTC+8, hongy...@gmail.com wrote:
> > On Tuesday, October 12, 2021 at 6:25:43 PM UTC+8, Ben Bacarisse wrote:
> > > "hongy...@gmail.com" <hongy...@gmail.com> writes:
> > >
> > > > For short, as shown below:
> > > >
> > > > $ md5sum <<< 'TASCJO3RJMVKWDJKXLZM'
> > > > e1b8fa8fe09c295811063bb76cefc337 -
> > > >
> > > > $ ipython
> > > > In [1]: from hashlib import md5
> > > >
> > > > In [2]: my_str='TASCJO3RJMVKWDJKXLZM'
> > > >
> > > > In [3]: md5(my_str.encode('utf-8')).hexdigest()
> > > > Out[3]: 'e9032994dabac08080091151380478a2'
> > > >
> > > > Any hints for this behavior?
> > > >>> md5("TASCJO3RJMVKWDJKXLZM\n".encode('utf-8')).hexdigest()
> > > 'e1b8fa8fe09c295811063bb76cefc337'
> > Thank you for pointing this out. I confirmed it with the following command:
> >
> > $ cat -A <<< 'TASCJO3RJMVKWDJKXLZM'
> > TASCJO3RJMVKWDJKXLZM$
> >
> > But how to supply string for md5sum without '\n'?
> I see. Here it is:
>
> $ echo -n 'TASCJO3RJMVKWDJKXLZM' | md5sum
> e9032994dabac08080091151380478a2 -

So, it seems that the `<<<' will also append `\n' at the end of the string.

HZ

Re: The same string will generate different md5sums by python and md5sum tool.

<op.1a5imbv3a3w0dxdave@hodgins.homeip.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4476&group=comp.unix.shell#4476

 copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!news.neodome.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dwhodg...@nomail.afraid.org (David W. Hodgins)
Newsgroups: comp.unix.shell
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
Date: Tue, 12 Oct 2021 09:04:49 -0400
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <op.1a5imbv3a3w0dxdave@hodgins.homeip.net>
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk>
<9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="b12d7a33c235156382cd497e86bbc30b";
logging-data="1405"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19vWmY/9OgdmCLtDb2ke9xWtMJh1W62+Kc="
User-Agent: Opera Mail/12.16 (Linux)
Cancel-Lock: sha1:Ciu2XFd+7819hs9B9YB1Crn2e1c=
 by: David W. Hodgins - Tue, 12 Oct 2021 13:04 UTC

On Tue, 12 Oct 2021 08:03:55 -0400, hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:

> On Tuesday, October 12, 2021 at 6:25:43 PM UTC+8, Ben Bacarisse wrote:
>> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>>
>> > For short, as shown below:
>> >
>> > $ md5sum <<< 'TASCJO3RJMVKWDJKXLZM'
>> > e1b8fa8fe09c295811063bb76cefc337 -
>> >
>> > $ ipython
>> > In [1]: from hashlib import md5
>> >
>> > In [2]: my_str='TASCJO3RJMVKWDJKXLZM'
>> >
>> > In [3]: md5(my_str.encode('utf-8')).hexdigest()
>> > Out[3]: 'e9032994dabac08080091151380478a2'
>> >
>> > Any hints for this behavior?
>> >>> md5("TASCJO3RJMVKWDJKXLZM\n".encode('utf-8')).hexdigest()
>> 'e1b8fa8fe09c295811063bb76cefc337'
>
> Thank you for pointing this out. I confirmed it with the following command:
>
> $ cat -A <<< 'TASCJO3RJMVKWDJKXLZM'
> TASCJO3RJMVKWDJKXLZM$
>
> But how to supply string for md5sum without '\n'?

$ echo -n 'TASCJO3RJMVKWDJKXLZM' |md5sum
e9032994dabac08080091151380478a2 -

Regards, Dave Hodgins

--
Change dwhodgins@nomail.afraid.org to davidwhodgins@teksavvy.com for
email replies.

Re: The same string will generate different md5sums by python and md5sum tool.

<sk41j7$ui9$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4477&group=comp.unix.shell#4477

 copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!news.neodome.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: unr...@invalid.ca (William Unruh)
Newsgroups: comp.unix.shell
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
Date: Tue, 12 Oct 2021 13:12:07 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <sk41j7$ui9$1@dont-email.me>
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk>
<9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
<ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com>
<33e5eb0a-3d7d-48ca-8c16-a9d7c59540c4n@googlegroups.com>
Injection-Date: Tue, 12 Oct 2021 13:12:07 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="6b936cbaaabbd0f4f5d0e6ec6d75d77b";
logging-data="31305"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rPQ6D3T3lLGXskpmfcARP"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:11OoK/UHrO2gNH+m8BUhPkrjV4Y=
 by: William Unruh - Tue, 12 Oct 2021 13:12 UTC

On 2021-10-12, hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
> On Tuesday, October 12, 2021 at 8:19:28 PM UTC+8, hongy...@gmail.com wrote:
>> On Tuesday, October 12, 2021 at 8:03:58 PM UTC+8, hongy...@gmail.com wrote:
>> > On Tuesday, October 12, 2021 at 6:25:43 PM UTC+8, Ben Bacarisse wrote:
>> > > "hongy...@gmail.com" <hongy...@gmail.com> writes:
>> > >
>> > > > For short, as shown below:
>> > > >
>> > > > $ md5sum <<< 'TASCJO3RJMVKWDJKXLZM'
>> > > > e1b8fa8fe09c295811063bb76cefc337 -
>> > > >
>> > > > $ ipython
>> > > > In [1]: from hashlib import md5
>> > > >
>> > > > In [2]: my_str='TASCJO3RJMVKWDJKXLZM'
>> > > >
>> > > > In [3]: md5(my_str.encode('utf-8')).hexdigest()
>> > > > Out[3]: 'e9032994dabac08080091151380478a2'
>> > > >
>> > > > Any hints for this behavior?
>> > > >>> md5("TASCJO3RJMVKWDJKXLZM\n".encode('utf-8')).hexdigest()
>> > > 'e1b8fa8fe09c295811063bb76cefc337'
>> > Thank you for pointing this out. I confirmed it with the following command:
>> >
>> > $ cat -A <<< 'TASCJO3RJMVKWDJKXLZM'
>> > TASCJO3RJMVKWDJKXLZM$
>> >
>> > But how to supply string for md5sum without '\n'?
>> I see. Here it is:
>>
>> $ echo -n 'TASCJO3RJMVKWDJKXLZM' | md5sum
>> e9032994dabac08080091151380478a2 -
>
> So, it seems that the `<<<' will also append `\n' at the end of the string.
>
> HZ

From man bash

Here Strings
A variant of here documents, the format is:

[n]<<<word

The word undergoes tilde expansion, parameter and variable expansion, command substitu-
tion, arithmetic expansion, and quote removal. Pathname expansion and word splitting are
not performed. The result is supplied as a single string, with a newline appended, to
the command on its standard input (or file descriptor n if n is specified).

Note the second last line.

Re: The same string will generate different md5sums by python and md5sum tool.

<slrnsmb0ep.304g.naddy@lorvorc.mips.inka.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4478&group=comp.unix.shell#4478

 copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: nad...@mips.inka.de (Christian Weisgerber)
Newsgroups: comp.unix.shell
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
Date: Tue, 12 Oct 2021 12:38:49 -0000 (UTC)
Message-ID: <slrnsmb0ep.304g.naddy@lorvorc.mips.inka.de>
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk>
<9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
Injection-Date: Tue, 12 Oct 2021 12:38:49 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
logging-data="98449"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
 by: Christian Weisgerber - Tue, 12 Oct 2021 12:38 UTC

On 2021-10-12, hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:

> But how to supply string for md5sum without '\n'?

$ printf '%s' 'TASCJO3RJMVKWDJKXLZM' | md5
e9032994dabac08080091151380478a2

--
Christian "naddy" Weisgerber naddy@mips.inka.de

Re: The same string will generate different md5sums by python and md5sum tool.

<sk459l$g4t$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4479&group=comp.unix.shell#4479

 copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortons...@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
Date: Tue, 12 Oct 2021 09:15:17 -0500
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <sk459l$g4t$1@dont-email.me>
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk>
<9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
<ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com>
<33e5eb0a-3d7d-48ca-8c16-a9d7c59540c4n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Oct 2021 14:15:18 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="3d47812ac62838c32851effdbe325e4d";
logging-data="16541"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uGGfgGVh1vsfyYt8KhNym"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:l9eL5PRdLzSQveuZNZmBXZRCb1U=
In-Reply-To: <33e5eb0a-3d7d-48ca-8c16-a9d7c59540c4n@googlegroups.com>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 211012-0, 10/11/2021), Outbound message
 by: Ed Morton - Tue, 12 Oct 2021 14:15 UTC

On 10/12/2021 7:21 AM, hongy...@gmail.com wrote:
> On Tuesday, October 12, 2021 at 8:19:28 PM UTC+8, hongy...@gmail.com wrote:
>> On Tuesday, October 12, 2021 at 8:03:58 PM UTC+8, hongy...@gmail.com wrote:
>>> On Tuesday, October 12, 2021 at 6:25:43 PM UTC+8, Ben Bacarisse wrote:
>>>> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>>>>
>>>>> For short, as shown below:
>>>>>
>>>>> $ md5sum <<< 'TASCJO3RJMVKWDJKXLZM'
>>>>> e1b8fa8fe09c295811063bb76cefc337 -
>>>>>
>>>>> $ ipython
>>>>> In [1]: from hashlib import md5
>>>>>
>>>>> In [2]: my_str='TASCJO3RJMVKWDJKXLZM'
>>>>>
>>>>> In [3]: md5(my_str.encode('utf-8')).hexdigest()
>>>>> Out[3]: 'e9032994dabac08080091151380478a2'
>>>>>
>>>>> Any hints for this behavior?
>>>>>>> md5("TASCJO3RJMVKWDJKXLZM\n".encode('utf-8')).hexdigest()
>>>> 'e1b8fa8fe09c295811063bb76cefc337'
>>> Thank you for pointing this out. I confirmed it with the following command:
>>>
>>> $ cat -A <<< 'TASCJO3RJMVKWDJKXLZM'
>>> TASCJO3RJMVKWDJKXLZM$
>>>
>>> But how to supply string for md5sum without '\n'?
>> I see. Here it is:
>>
>> $ echo -n 'TASCJO3RJMVKWDJKXLZM' | md5sum
>> e9032994dabac08080091151380478a2 -
>
> So, it seems that the `<<<' will also append `\n' at the end of the string.
>
> HZ
>

Right, it's saving a string into a temp file and than using that as the
input to the command so, since every line in a POSIX text file must end
in `\n`, `<<<` has to add one. It's equivalent to manually writing:

tmp=$(mktemp) &&
printf '%s\n' 'TASCJO3RJMVKWDJKXLZM' > "$tmp" &&
md5sum < "$tmp"
rm -f -- "$tmp"

Regards,

Ed.

Re: The same string will generate different md5sums by python and md5sum tool.

<835yu2drx9.fsf@helmutwaitzmann.news.arcor.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4480&group=comp.unix.shell#4480

 copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!i2pn.org!aioe.org!jSP+97RH+z8govWAXlk1OA.user.46.165.242.75.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: The same string will generate different md5sums by python and md5sum tool.
Date: Tue, 12 Oct 2021 20:22:26 +0200
Organization: Aioe.org NNTP Server
Message-ID: <835yu2drx9.fsf@helmutwaitzmann.news.arcor.de>
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk>
<9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
<ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com>
<33e5eb0a-3d7d-48ca-8c16-a9d7c59540c4n@googlegroups.com>
<sk459l$g4t$1@dont-email.me>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mime-Version: 1.0
Content-Type: text/plain; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Info: gioia.aioe.org; logging-data="40314"; posting-host="jSP+97RH+z8govWAXlk1OA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Cancel-Lock: sha1:OfGXyoXaff991Cx1YQkhd0WypUA=
Mail-Copies-To: nobody
X-Notice: Filtered by postfilter v. 0.9.2
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
 by: Helmut Waitzmann - Tue, 12 Oct 2021 18:22 UTC

Ed Morton <mortonspam@gmail.com>:

>Right, it's saving a string into a temp file and than using that as
>the input to the command so, since every line in a POSIX text file
>must end in `\n`, `<<<` has to add one. It's equivalent to manually
>writing:
>
> tmp=$(mktemp) &&
> printf '%s\n' 'TASCJO3RJMVKWDJKXLZM' > "$tmp" &&
> md5sum < "$tmp"
> rm -f -- "$tmp"

On my debian linux machine it's more like

(
tmp="$(mktemp)" &&
printf '%s\n' 'TASCJO3RJMVKWDJKXLZM' > "$tmp" &&
exec 0< "$tmp" &&
rm -f -- "$tmp" &&
exec md5sum
)

Re: The same string will generate different md5sums by python and md5sum tool.

<d08c1f0f-7ba9-431e-b9e6-8022c0014e11n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4482&group=comp.unix.shell#4482

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ac8:5cd0:: with SMTP id s16mr8442227qta.287.1634094367185;
Tue, 12 Oct 2021 20:06:07 -0700 (PDT)
X-Received: by 2002:a05:6214:448:: with SMTP id cc8mr33481950qvb.28.1634094367079;
Tue, 12 Oct 2021 20:06:07 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 12 Oct 2021 20:06:06 -0700 (PDT)
In-Reply-To: <835yu2drx9.fsf@helmutwaitzmann.news.arcor.de>
Injection-Info: google-groups.googlegroups.com; posting-host=60.249.28.129; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 60.249.28.129
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk> <9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
<ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com> <33e5eb0a-3d7d-48ca-8c16-a9d7c59540c4n@googlegroups.com>
<sk459l$g4t$1@dont-email.me> <835yu2drx9.fsf@helmutwaitzmann.news.arcor.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d08c1f0f-7ba9-431e-b9e6-8022c0014e11n@googlegroups.com>
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 13 Oct 2021 03:06:07 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 24
 by: hongy...@gmail.com - Wed, 13 Oct 2021 03:06 UTC

On Wednesday, October 13, 2021 at 2:23:56 AM UTC+8, Helmut Waitzmann wrote:
> Ed Morton <morto...@gmail.com>:
> >Right, it's saving a string into a temp file and than using that as
> >the input to the command so, since every line in a POSIX text file
> >must end in `\n`, `<<<` has to add one. It's equivalent to manually
> >writing:
> >
> > tmp=$(mktemp) &&
> > printf '%s\n' 'TASCJO3RJMVKWDJKXLZM' > "$tmp" &&
> > md5sum < "$tmp"
> > rm -f -- "$tmp"
> On my debian linux machine it's more like
>
>
> (
> tmp="$(mktemp)" &&
> printf '%s\n' 'TASCJO3RJMVKWDJKXLZM' > "$tmp" &&
> exec 0< "$tmp" &&
> rm -f -- "$tmp" &&
> exec md5sum
> )

I'm on Ubuntu 20.04.2 LTS, both the above two methods work, but why do you prefer the latter?

HZ

Re: The same string will generate different md5sums by python and md5sum tool.

<77e943d0-26b2-4909-988f-2fbe1a03b653n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4483&group=comp.unix.shell#4483

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:13c8:: with SMTP id p8mr16994166qtk.162.1634094470787;
Tue, 12 Oct 2021 20:07:50 -0700 (PDT)
X-Received: by 2002:a05:620a:1a89:: with SMTP id bl9mr13310954qkb.459.1634094470659;
Tue, 12 Oct 2021 20:07:50 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Tue, 12 Oct 2021 20:07:50 -0700 (PDT)
In-Reply-To: <sk41j7$ui9$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=172.104.173.61; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 172.104.173.61
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk> <9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
<ef7ac889-2b4b-4c0f-91c8-67e26b721adfn@googlegroups.com> <33e5eb0a-3d7d-48ca-8c16-a9d7c59540c4n@googlegroups.com>
<sk41j7$ui9$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <77e943d0-26b2-4909-988f-2fbe1a03b653n@googlegroups.com>
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Wed, 13 Oct 2021 03:07:50 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 52
 by: hongy...@gmail.com - Wed, 13 Oct 2021 03:07 UTC

On Tuesday, October 12, 2021 at 9:12:10 PM UTC+8, William Unruh wrote:
> On 2021-10-12, hongy...@gmail.com <hongy...@gmail.com> wrote:
> > On Tuesday, October 12, 2021 at 8:19:28 PM UTC+8, hongy...@gmail.com wrote:
> >> On Tuesday, October 12, 2021 at 8:03:58 PM UTC+8, hongy...@gmail.com wrote:
> >> > On Tuesday, October 12, 2021 at 6:25:43 PM UTC+8, Ben Bacarisse wrote:
> >> > > "hongy...@gmail.com" <hongy...@gmail.com> writes:
> >> > >
> >> > > > For short, as shown below:
> >> > > >
> >> > > > $ md5sum <<< 'TASCJO3RJMVKWDJKXLZM'
> >> > > > e1b8fa8fe09c295811063bb76cefc337 -
> >> > > >
> >> > > > $ ipython
> >> > > > In [1]: from hashlib import md5
> >> > > >
> >> > > > In [2]: my_str='TASCJO3RJMVKWDJKXLZM'
> >> > > >
> >> > > > In [3]: md5(my_str.encode('utf-8')).hexdigest()
> >> > > > Out[3]: 'e9032994dabac08080091151380478a2'
> >> > > >
> >> > > > Any hints for this behavior?
> >> > > >>> md5("TASCJO3RJMVKWDJKXLZM\n".encode('utf-8')).hexdigest()
> >> > > 'e1b8fa8fe09c295811063bb76cefc337'
> >> > Thank you for pointing this out. I confirmed it with the following command:
> >> >
> >> > $ cat -A <<< 'TASCJO3RJMVKWDJKXLZM'
> >> > TASCJO3RJMVKWDJKXLZM$
> >> >
> >> > But how to supply string for md5sum without '\n'?
> >> I see. Here it is:
> >>
> >> $ echo -n 'TASCJO3RJMVKWDJKXLZM' | md5sum
> >> e9032994dabac08080091151380478a2 -
> >
> > So, it seems that the `<<<' will also append `\n' at the end of the string.
> >
> > HZ
> From man bash
>
> Here Strings
> A variant of here documents, the format is:
>
> [n]<<<word
>
> The word undergoes tilde expansion, parameter and variable expansion, command substitu-
> tion, arithmetic expansion, and quote removal. Pathname expansion and word splitting are
> not performed. The result is supplied as a single string, with a newline appended, to
> the command on its standard input (or file descriptor n if n is specified).
>
>
> Note the second last line.

Thank you for pointing this out.

Re: The same string will generate different md5sums by python and md5sum tool.

<bjkl3i-hhh.ln1@ID-313840.user.individual.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4485&group=comp.unix.shell#4485

 copy link   Newsgroups: comp.unix.shell
Path: rocksolid2!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: geo...@clare.See-My-Signature.invalid (Geoff Clare)
Newsgroups: comp.unix.shell
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
Date: Thu, 14 Oct 2021 13:32:11 +0100
Lines: 22
Message-ID: <bjkl3i-hhh.ln1@ID-313840.user.individual.net>
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk>
<9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
<op.1a5imbv3a3w0dxdave@hodgins.homeip.net>
Reply-To: netnews@gclare.org.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net w9Preggy1lPVQsdwfrQ0Yww/WgqRQHG+YUr3rriUpG4WfXkbzx
X-Orig-Path: ID-313840.user.individual.net!not-for-mail
Cancel-Lock: sha1:6E6/3GHdpKJY0Rrv1TyVoe+qTgg=
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
 by: Geoff Clare - Thu, 14 Oct 2021 12:32 UTC

David W. Hodgins wrote:

> On Tue, 12 Oct 2021 08:03:55 -0400, hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
>
>> But how to supply string for md5sum without '\n'?
>
> $ echo -n 'TASCJO3RJMVKWDJKXLZM' |md5sum
> e9032994dabac08080091151380478a2 -

Only if you use a version of echo that does not conform to UNIX
requirements (even though it may conform to POSIX requirements).
POSIX allows -n to be special, but UNIX does not. A UNIX-conforming
echo does this:

$ echo -n foo
-n foo
$

The portable way to omit the newline is to use printf.

--
Geoff Clare <netnews@gclare.org.uk>

Re: The same string will generate different md5sums by python and md5sum tool.

<fce93ddc-ee66-4846-8f58-b0c7824c0ec1n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=4489&group=comp.unix.shell#4489

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:390:: with SMTP id j16mr450535qtx.243.1634272862746;
Thu, 14 Oct 2021 21:41:02 -0700 (PDT)
X-Received: by 2002:a05:622a:1315:: with SMTP id v21mr11223389qtk.231.1634272862503;
Thu, 14 Oct 2021 21:41:02 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Thu, 14 Oct 2021 21:41:02 -0700 (PDT)
In-Reply-To: <bjkl3i-hhh.ln1@ID-313840.user.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=172.105.215.95; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 172.105.215.95
References: <d6a93df1-0bd4-47e2-afa8-011a3e895ffan@googlegroups.com>
<878ryybkuz.fsf@bsb.me.uk> <9a464b53-47d4-471b-b905-57e1b4197f5an@googlegroups.com>
<op.1a5imbv3a3w0dxdave@hodgins.homeip.net> <bjkl3i-hhh.ln1@ID-313840.user.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fce93ddc-ee66-4846-8f58-b0c7824c0ec1n@googlegroups.com>
Subject: Re: The same string will generate different md5sums by python and
md5sum tool.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 15 Oct 2021 04:41:02 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 22
 by: hongy...@gmail.com - Fri, 15 Oct 2021 04:41 UTC

On Thursday, October 14, 2021 at 8:41:05 PM UTC+8, Geoff Clare wrote:
> David W. Hodgins wrote:
>
> > On Tue, 12 Oct 2021 08:03:55 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
> >
> >> But how to supply string for md5sum without '\n'?
> >
> > $ echo -n 'TASCJO3RJMVKWDJKXLZM' |md5sum
> > e9032994dabac08080091151380478a2 -
> Only if you use a version of echo that does not conform to UNIX
> requirements (even though it may conform to POSIX requirements).
> POSIX allows -n to be special, but UNIX does not. A UNIX-conforming
> echo does this:
>
> $ echo -n foo
> -n foo
> $
>
> The portable way to omit the newline is to use printf.

Thank you for pointing this out.

HZ

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor