Login   Register  
PHP Classes
elePHPant
Icontem

File: encrypt.lib.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of BasicA  >  encrypt.lib  >  encrypt.lib.php  >  Download  
File: encrypt.lib.php
Role: ???
Content type: text/plain
Description: encryption library (simple version)
Class: encrypt.lib
Author: By
Last change:
Date: 2001-03-17 22:55
Size: 975 bytes
 

Contents

Class file image Download
<?php

	function kPHPCrypt($strDataIn) {
		return StrRevCrypt(ROT13Crypt($strDataIn));
	}

	function ROT13Crypt($strDataIn) {
		
		//ABCDEFGHIJKLM
		//NOPQRSTUVWXYZ

		$newString = "";
		
		for ($i = 0; $i < strlen($strDataIn); $i++) {

			$temp = substr($strDataIn, $i, 1);
			$asc = ord($temp);

			$newChar = $temp;

			if (($asc >= 65) && ($asc <= 90)) {
				if ($asc <= 65 + 12) $newChar = chr($asc + 13);
				if ($asc >= 65 + 13) $newChar = chr($asc - 13);
			}
			
			if (($asc >= 97) && ($asc <= 122)) {
				if ($asc <= 97 + 12) $newChar = chr($asc + 13);
				if ($asc >= 97 + 13) $newChar = chr($asc - 13);
			}

			$newString = $newString . $newChar;			
			
		}

		return $newString;

	}


	function StrRevCrypt($strDataIn) {

		$newString = "";
		
		for ($i = strlen($strDataIn) - 1; $i >= 0; $i--) {
			$temp = substr($strDataIn, $i, 1);
			$newString = $newString . $temp;
		}

		return $newString;

	}

?>