deepakg has asked for the wisdom of the Perl Monks concerning the following question:
use Digest::SHA1; $text = "deepak.gulati"; $hash1 = `echo -n $text | openssl dgst -sha1`; chomp ($hash1); print "$hash1\n"; $hash2 = Digest::SHA1::sha1_hex($text); print "$hash2\n";I expected $hash1 and $hash2 to be equal, but that is not the case. I suspect using grave accent has some caveats. What am I missing here? Incidentally running echo -n "deepak.gulati" | openssl dgst -sha1 from shell gives the same value as $hash2. Is `echo -n $text | openssl dgst -sha1` different from issuing the same command on shell?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Grave accent caveats
by derby (Abbot) on Jan 19, 2009 at 17:17 UTC | |
by massa (Hermit) on Jan 19, 2009 at 17:23 UTC | |
by jethro (Monsignor) on Jan 19, 2009 at 18:05 UTC | |
by deepakg (Novice) on Jan 19, 2009 at 17:30 UTC | |
|
Re: Grave accent caveats
by almut (Canon) on Jan 19, 2009 at 17:17 UTC | |
by deepakg (Novice) on Jan 19, 2009 at 17:25 UTC | |
by derby (Abbot) on Jan 19, 2009 at 17:38 UTC | |
by deepakg (Novice) on Jan 19, 2009 at 17:45 UTC | |
by derby (Abbot) on Jan 19, 2009 at 18:06 UTC | |
| |
|
Re: Grave accent/Backtick/`` caveats
by Your Mother (Archbishop) on Jan 19, 2009 at 17:53 UTC |