Jump to content

Encrypting with php - need help


cland410

Recommended Posts

Hey guys, I was wondering if there was anyway to encrypt usernames and passwords when being passed through a form to another page (just in case there is someone listening that can read the packets). I was using wireshark on my website and it was very visible to see the username and password that was being passed. I guess many people use md5 to cover this information and was wondering if anyone has any good use of this function or if there are any other ways of encrypting this information... I am also trying to cover up file names that can get me downloaded as well. Basically, I am looking for good protection without using SSL (which I am having a little trouble understanding, mainly because it is not something that is free, and/or because you need an outside web host or application installed on your server?) Thanks, I appreciate any feedback.

Link to comment
https://forums.phpfreaks.com/topic/164759-encrypting-with-php-need-help/
Share on other sites

Try this.  I would always recommend using SSL to encrypt data that is considered sensitive.  Such as, CC, Account Information, Etc. This following function will encrypt the string you pass to it.  You will need to call it again when you retrieve it from the database.  Good Luck!!

 


<?php

// Scramble Password

	function encode5t($str)
	{
	  for($i=0; $i<5;$i++)
	  {
		$str=strrev(base64_encode($str)); //apply base64 first and then reverse the string
	  }
	  return $str;
}

//function to decrypt the Passord

function decode5t($str)
	{
	  for($i=0; $i<5;$i++)
	  {
		$str=base64_decode(strrev($str)); //apply base64 first and then reverse the string}
	  }
	  return $str;
}
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.