top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How md5 function works in PHP?

+1 vote
443 views
How md5 function works in PHP?
posted May 15, 2014 by Karamjeet Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

+2 votes

MD5 function is used for encrypting the passwords.Encryption of passwords is necessary due to security reasons.

answer May 16, 2014 by Sakshi Agarwal
+2 votes

The md5() function calculates the MD5 hash of a string which is a one pass way of encrypting a string. Here it is important to know the meaning of one pass: "One pass means that from the result you can not get the original string back using the current computing power".

Let see what RFC-1321 says about the MD5 Algorithm - "The MD5 message-digest algorithm takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input. The MD5 algorithm is intended for digital signature applications, where a large file must be "compressed" in a secure manner before being encrypted with a private (secret) key under a public-key crypto system such as RSA."

SYNTAX of MD5

md5(string,raw)
where 
string: any valid string and must 
raw: optional (can have true or false where as false is default behavior) 
     TRUE - Raw 16 character binary format
     FALSE - Default. 32 character hex number

Example

$str = "QueryHome";
echo md5($str);
answer May 16, 2014 by Salil Agrawal
0 votes

The md5() function calculates the MD5 hash of a string.

The md5() function uses the RSA Data Security, Inc. MD5 Message-Digest Algorithm

answer May 16, 2014 by Vrije Mani Upadhyay
Similar Questions
0 votes

If I am using an editor such as Eclipse to analyze a large PHP system and I want to find the file that a function is declared in then I can search for it. I think that the (right-click) context menu for the function sometimes has an item to open the declaration but that does not always work. The same for an include statement; even if I don't know what the path will be during execution and even if the source is in multiple folders, I can search for the file. For large systems however all that can take time (my time).

Is there a tool that can process thousands (at least a couple thousand) files and produce data of what file that a called function exists in and where a function is called from? In other words, caller/called data. I understand the technical challenges. In PHP includes are processed during execution so I know it might not be possible but I am asking if there is anything that can do it as much as possible.

+1 vote

I'm writing my first php extension and I need to list included files (in PHP script) from RINIT function, but I cannot figure out how.

I deep into PHP source code and I think it's related to EG(included_files), but I can't to access the list.

PHP_RINIT_FUNCTION(extname)
{
 // SAPI NAME AND PHP SCRIPT FILE HANDLE PATH
 char *pt_var_sapi_name = sapi_module.name;
 char *pt_var_file_handle_path = SG(request_info).path_translated;

 // HOW CAN I USE EG(included_files) to get included files list?

 return SUCCESS;
}
...