<?php
function POA($password) {
	/*
	Password Obfuscation Algorithm
	Author: Brendan M. (http://www.bren2010.com)
	Date: January 19, 2010

	Actions:
		1. Add the values of all the characters in the password together, called total.
		2. Multiply the ascii value of each character by the total, called numbers.
		3. Combine the numbers into a string, called string.
		4. Get the very first number, called prime.
		5. Seperate the string into equal parts described by the prime, called array.
		6. Hash each value of the array with SHA1 and combine into string, called hash.
		7. Hash the hash with MD5, and add it to the end of the hash, called finalHash.
		8. Return final hash.
	*/
	
	// Step one.
	$letters = str_split($password, 1);
	$total = 0;
	
	foreach($letters as $letter) {
		$ascii = ord($letter);
		$total += $ascii;
	}
	
	// Step two.
	$numbers = array();
	$letters = str_split($password, 1);
	
	foreach($letters as $letter) {
		$ascii = ord($letter);
		$mult = $ascii * $total;
		
		array_push($numbers, $mult);
	}
	
	// Step three.
	$string = implode($numbers);
	
	// Step four.
	$prime = substr($string, 0, 1);
	
	// Step five.
	$array = str_split($string, $prime);
	
	// Step six.
	$hashArray = array();
	
	foreach($array as $section) {
		$hash = sha1($section);
		array_push($hashArray, $hash);
	}
	
	$hash = implode($hashArray);
	
	// Step seven.
	$fHash = md5($hash);
	$finalHash = $hash . $fHash;
	
	// Step eight.
	return $finalHash;
}
?>