how to md5 a string
Heike C. Zimmerer
nospam08q2 at gmx.net
Mon May 11 22:20:24 UTC 2009
prad <prad at towardsfreedom.com> writes:
> On Mon, 11 May 2009 23:31:25 +0200
> Wybo Dekker <wybo at servalys.nl> wrote:
>
>> It's easy to miss, indeed:
>>
>> DESCRIPTION
>> Print or check MD5 (128-bit) checksums. With no FILE, or
>> when FILE is -, read standard input.
>>
> i saw that, but obviously didn't understand it.
> on retrospect, i guess read standard input means echo something and in
> order to get it to md5sum, you have to pipe it.
>
> is that how i should be reading these things?
Yes, it is quite common that utilities use standard input as default and
to pass them text this way.
And, btw, instead of echo it is the preferred method to use printf,
since there are strings you cannot safely pass through echo. The latter
is the case if the string looks like an option to echo, e.g. if the
string happens to be "-e" (for GNU echo). Better use
printf "%s" "your string" | md5sum
as it is safe for any text content.
Heike
More information about the ubuntu-users
mailing list