PHP hashing generator

Information for PHP. Hypertext Preprocessor
Post Reply
dzcadii
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

PHP hashing generator

Post by dzcadii » Sun Mar 01, 2015 6:36 pm

Some of the hashing methods are:
  • md5()
    sha1()
    rand()
    uniqid()
Simply select the required options and see your results

You can see a demonstration at http://jobs.dzsoundnirvana.com/m5/

Here is the code if you want to use it locally:

Code: Select all

<?
echo "<html><head><title>DzSoundNirvana.com's Hashing</title></head><body bgcolor=\"#000000\" text=\"#ffffff\">";

if($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['action'] == 1)
{
	switch($_POST)
	{
		case($_POST['type'] == "md5"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for md5(&#36;value)</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . md5($value) . "</div></td><td><div align=\"center\">" . strlen(md5($value)) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "sha1"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for sha1(&#36;value)</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . sha1($value) . "</div></td><td><div align=\"center\">" . strlen(sha1($value)) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "md5sha1"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for md5(sha1(&#36;value))</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . md5(sha1($value)) . "</div></td><td><div align=\"center\">" . strlen(md5(sha1($value))) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "uniquefname"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for unique file name (uniqid(md5(rand() . &#36;value), true))</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . uniqid(md5(rand() . $value), true) . "</div></td><td><div align=\"center\">" . strlen(uniqid(md5(rand() . $value), true)) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "sha1md5"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for sha1(md5(&#36;value))</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . sha1(md5($value)) . "</div></td><td><div align=\"center\">" . strlen(sha1(md5($value))) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "uniqid"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for uniqid(&#36;value)</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
		//uniqid(md5(rand()), true)
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . uniqid($value) . "</div></td><td><div align=\"center\">" . strlen(uniqid($value)) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "uniqidt"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for uniqid(&#36;value, true)</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
		//uniqid(md5(rand()), true)
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . uniqid($value, true) . "</div></td><td><div align=\"center\">" . strlen(uniqid($value, true)) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "md5uniqid"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for md5(uniqid(&#36;value))</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
		//uniqid(md5(rand()), true)
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . md5(uniqid($value)) . "</div></td><td><div align=\"center\">" . strlen(md5(uniqid($value))) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "md5uniqidt"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for md5(uniqid(&#36;value, true))</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . md5(uniqid($value, true)) . "</div></td><td><div align=\"center\">" . strlen(md5(uniqid($value, true))) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "uniqidmd5"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for uniqid(md5(&#36;value))</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . uniqid(md5($value)) . "</div></td><td><div align=\"center\">" . strlen(uniqid(md5($value))) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
		
		
		
		case($_POST['type'] == "uniqidmd5t"):
		echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" align=\"center\"><tr><td colspan=\"4\"><div align=\"center\">Here are your results for uniqid(md5(&#36;value), true)</div></td></tr><tr><td><div align=\"center\"><strong>Text:</strong></div></td><td><div align=\"center\"><strong>Text Length:</strong></div></td><td><div align=\"center\"><strong>Hash:</strong></div></td><td><div align=\"center\"><strong>Hash Length:</strong></div></td></tr><tr><td colspan=\"4\"><hr></td></tr>";
		$clean_arr = array();
		foreach($_POST as $key => $value)
		{
			$clean_arr[$key] = $value;
		}
		unset($clean_arr['action'],$clean_arr['type'],$clean_arr['count']);
		foreach($clean_arr as $key => $value)
		{
			echo "<tr><td><div align=\"center\"><textarea cols=\"35\" rows=\"2\" readonly>" . wordwrap($value,35,"\n",true) . "</textarea></div></td><td><div align=\"center\">" . strlen($value) . "</div></td><td><div align=\"center\">" . uniqid(md5($value), true) . "</div></td><td><div align=\"center\">" . strlen(uniqid(md5($value), true)) . "</div></td></tr>";
		}
		
		echo "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table>";
		break;
	}	
}
elseif($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['action'] == 2)
{
	echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr><td><div align=\"center\"><input type=\"hidden\" name=\"action\" value=\"3\"><input type=\"hidden\" name=\"type\" value=\"$_POST[type]\">How many do you need? (max of 25)</div></td></tr><tr><td><div align=\"center\"><select name=\"count\">";
	$i=0;
	while($i < 26)
	{
		echo "<option value=\"$i\">$i</option>";
		$i++;
	}
	echo "</select></div></td></tr><tr><td><div align=\"center\"><input type=\"submit\" value=\"Submit\"></div></td></tr><tr><td><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table></form>";
}
elseif($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['action'] == 3)
{
	echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr><td><div align=\"center\"><input type=\"hidden\" name=\"action\" value=\"1\"><input type=\"hidden\" name=\"type\" value=\"$_POST[type]\"><input type=\"hidden\" name=\"count\" value=\"$_POST[count]\"></div></td></tr>";
	$i=0;
	while($i != $_POST['count'])
	{
		echo "<tr><td>Enter in the text your want hashed!</div></td><td><div align=\"center\"><input type=\"text\" name=\"H$i\"></td></tr>";
		$i++;
	}
		echo "<tr><td><div align=\"center\"><input type=\"submit\" value=\"Submit\"></div></td></tr><tr><td><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table></form>";
}
else
{
	echo "<form method=\"post\" action=\"$_SERVER[PHP_SELF]\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr><td><div align=\"center\"><input type=\"hidden\" name=\"action\" value=\"2\">What type of hashing?</div></td></tr><tr><td><div align=\"center\"><select name=\"type\"><option value=\"md5\">md5(&#36;value)</option><option value=\"md5uniqid\">md5(uniqid(&#36;value))</option><option value=\"md5uniqidt\">md5(uniqid(&#36;value, true))</option><option value=\"md5sha1\">md5(sha1(&#36;value))</option><option value=\"sha1\">sha1(&#36;value)</option><option value=\"sha1md5\">sha1(md5(&#36;value))</option><option value=\"uniqid\">uniqid(&#36;value)</option><option value=\"uniqidt\">uniqid(&#36;value, true)</option><option value=\"uniqidmd5\">uniqid(md5(&#36;value))</option><option value=\"uniqidmd5t\">uniqid(md5(&#36;value), true)</option><option value=\"uniquefname\">unique file name (uniqid(md5(rand() . &#36;value), true))</option></select></div></td></tr><tr><td><div align=\"center\"><input type=\"submit\" value=\"Submit\"></div></td></tr><tr><td><div align=\"center\"><a href=\"$_SERVER[PHP_SELF]\" target=\"_self\">Start Over/Generate some more</a></div></td></tr></table></form>";
}
echo "</body></html>";
?>

Post Reply