It's the same as your original problem: different end-of-line markers
Try this instead:
echo -n "1122" | openssl dgst -md5
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Roberto Arias Alegria
Sent: Tuesday, 30 August 2005 2:01 PM
To: [email protected]
Subject: Re: Reading from standard input
Thanks people,
Yeah I think the end of line was the key. After reading your posts I
realised that I needed this:
echo "mytext" | openssl dgst -md5
Anyway, I don't know why I got different hashes:
Using openssl:
echo "1122" | openssl dgst -md5
01ebeaafc334e503f4acc94a18df9fa5
and using MySQL:
SELECT md5("1122");
3b712de48137572f3849aabd5666a4e3
//roberto8080
On 8/29/05, Victor Duchovni <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 29, 2005 at 06:42:07PM -0500, Roberto Arias Alegria wrote:
>
> > Hello new around here,
> >
> > I'm just new to OpenSSL and I'd like to calculate a MD5 digest, I
> > used the command
> >
> > openssl dgst -md5 file.txt
> >
> > and I got a digest of the file, but I want a digest of what is
> > *inside* the file, a text string, not the file itself, it is
> > possible to do this?
> >
>
> The difference is the newline at the end of the string on each line of
> the file. To checksum each line (using the shell and openssl rather
> than the much easier Perl with Digest::MD5) but omit the terminating new
line:
>
> #! /bin/sh
> SAVEIFS="$IFS"
> IFS="
> "
> while read line
> do
> printf "%s" "$line" | openssl dgst -md5
> done < inputfile
> IFS="$SAVEIFS"
>
> --
> Viktor.
> ______________________________________________________________________
> OpenSSL Project http://www.openssl.org
> User Support Mailing List [email protected]
> Automated List Manager [EMAIL PROTECTED]
>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]