// file: passwordSecurity.php
<?php
class passwordSecurity
{
public function __construct ()
{
return;
}
public static function encode ($M)
{
$C = "";
for($i = 0; $i < strlen ($M); $i++)
$C.= chr((ord($M[$i]) + 3) % 255);
return $C;
}
public static function decode ($C)
{
$M = "";
for($i = 0; $i < strlen($C); $i++)
$M.= chr((ord($C[$i]) - 3 + 255) % 255);
return $M;
}
}
// file: where you need it
include ("path to passwordSecurity.php");
$password = "my secret password";
$password_encode = passwordSecurity::encode($password);
$password_decode = passwordSecurity::decode($password_encode);
Enjoy!
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.