S
S
Sergey2015-09-18 13:46:06
Perl
Sergey, 2015-09-18 13:46:06

What is the analogue in php of the md5 function from perl?

Hello everyone, there is a script in perl, I rewrite it in php and that's the trouble, the functions do not work the same way =(
I read that md5 in php works like md5_hex in perl, but here's how to make a function that will work similar to the md5 function from pearl.
Here is the code the pearl I'm porting:

use Digest::MD5  qw(md5 md5_hex md5_base64);
$hash  = md5($str1, $str2);

Here's how I try in php but I get a different result(
$hash = md5($str1.$str2);
Tell me guys, how to get the same result in $hash?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cat Anton, 2015-09-18
@buboon

md5($str1.$str2, true);

A
Alexander Chernykh, 2015-09-18
@sashkets

this is from the console, I think in the code you can also somehow write
php -r 'echo crypt("your_password", "salt");'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question