Showing posts with label encryption. Show all posts
Showing posts with label encryption. Show all posts

Tuesday, October 16, 2012

Encryption Functions in PHP: crypt() and md5()

Hi! In this article, I am going to share encryption functions on PHP programming language with you. Well, there are several functions about this subject, but here the point is crypt and md5.


md5 function is a text encryption. Here the text or string may be probably as password. md5 function makes the text a value which is 32-digit. Sure this value is probably going to be more complex than older text value.
print md5("phpservisi.com");
md5 function's output
The example given above shows us phpservisi.com string value's output with md5 function.

crypt function is the same mission with md5. Namely this is encryption function too. Here the variety is complexity of output. Because of it is some of us use this one, like me :) 

One more feature is the output of crypt function's about making one-way string hashing. crypt function will return a hashed string using alternative algorithms that may be available on the system.

Now, I'm coding about this:


echo crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com");

crypt function's output
As you've seen on the top is crypt function's output. I did the same thing 8 times, and crypt function has just given us different results about those.

If you want to learn more information about this subject, you can visit the PHP Manual web page: md5cryptsha1_filecrc32sha1hash