* <barry@blues.no>:
[color=blue]
> I'm curious how these two functions work together (when crypt() uses a
> md5 algo).[/color]
When crypt() "uses a MD5 algorithm", I'm assuming that that means that the
algorithm used by crypt() is similar to the one used by md5(). It *does
not* mean, however, that the output of crypt() will be an MD5 sum.
[color=blue]
> Currently I know they will produce different output; is this due to the
> salt being used behind-the-scenes in md5()?[/color]
If you have a function foo() that produces an MD5 sum, and another
function bar() that also produces an MD5 sum, the value of foo(string)
will /always/ be the same as the value of bar(string) -- in other words,
any given string has exactly one MD5 sum. (The converse is also almost
always true: any given MD5 sum can be produced by only one string.
Coincidentally, this is why MD5 is used for file verification and the
like.)
What this means is that if crypt() and md5() give different outputs, then
you know that one of them is not intended to generate MD5 sums. In this
case, that one is crypt().
[color=blue]
> Is there a way to allow crypt() and md5() to produce identical output or
> am I misunderstanding the purpose of both the functions.[/color]
I think you're misunderstanding it -- the purpose of crypt() is produce an
encrypted string with a given salt. The implementations of crypt() will
vary from system to system, as different systems implement it differently.
Therefore, the output of crypt() varies with different systems and salts.
MD5, on the other hand, is more of a universal algorithm -- the md5()
function on my computer will always give the same results as the md5()
function on your computer. The MD5 sum of a given string /doesn't vary/.
To answer your original question (sorry for the rambling) -- there is not,
AFAIK, any way to make crypt() output MD5 sums. You should use md5() for
that.
HTH,
--
Benjamin D. Esham {
http://bdesham.net bdesham@iname.com } AIM: bdesham 1 2 8
"Hmm... Earl Grey tea. Maybe that's how an old
bald guy can kick the Borg's collective ass."