jack5100nv Posted March 15, 2008 Share Posted March 15, 2008 I am interested in encrypting some text using PHP. I am currently looking at MCrypt Rijndael 256. Example: http://www.w3courses.com/index.php?subaction=showfull&id=1205620312&ucat=12&category=12&catdisplay=PHP I read somewhat about Mcrpyt and found that Mcrypt does not come with PHP, it needs to be installed separately. I am developing a script which i want to destribute to other users. I do not want my script to depend on Mcrypt if it is not widely used. Does anyone know what percentage of Apache servers have Mcrypt? It it safe to use or will my users have problems because of Mcrypt? Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 15, 2008 Share Posted March 15, 2008 I know dreamhost uses mcrypt. Your best bet here is anywhere you want to use mcrypt, check for it's existence, if it does use mcrypt, if it doesn't, send in plain text or use your own method. if (extension_loaded('mcrypt')) { // Do encryption } else { // Plain text } To avoid possible fatal errors, you could also check if function_exists() as well. Quote Link to comment Share on other sites More sharing options...
jack5100nv Posted March 15, 2008 Author Share Posted March 15, 2008 Thanks. I already have hosting. The problem is that I am going to post the script I am developeing on my site and people can download and install it. I do not want people to turn away just because they don't have Mcrypt. I do not know how many people have MCrypt. Or how many hosting compnies have Mcrypt installed on their servers. Is MCrypt a very widely used script? More than 90%? Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 15, 2008 Share Posted March 15, 2008 If you're going to ask for help, please pay more attention to the people that try to help you and your initial question. You asked if many servers ran mcrypt. My guess was you were interested mostly in hosting companies. Dreamhost is a very large hosting company, and they do support mcrypt. And I provided you a solution to your problem. If you use my snippet above, your application will run fine without mcrypt, and encrypt the data if they happen to have it. Quote Link to comment Share on other sites More sharing options...
jack5100nv Posted March 16, 2008 Author Share Posted March 16, 2008 Thanks. Your code will work. I will use it. I was also curious to know how popular Mcrypt actually is. Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 16, 2008 Share Posted March 16, 2008 Impossible to know unless you can phpinfo() every server on the 'net Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.