<\"'`|"; function Crypto( $Password = '' ) { if ( !empty ( $Password ) ) { return $this->password = $Password; } } function encrypt ( $strtoencrypt ) { $alphabet = $this->ralphabet . $this->ralphabet; if( !isset ( $this->password ) ) { return 'please supply a password'; } $strtoencrypt = str_replace( "\t", "[tab]", $strtoencrypt); $strtoencrypt = str_replace( "\n", "[new]", $strtoencrypt); $strtoencrypt = str_replace( "\r", "[ret]", $strtoencrypt); for( $i=0; $i < strlen ( $this->password ); $i++ ) { $cur_pswd_ltr = substr($this->password,$i,1); $pos_alpha_ary[] = substr(strstr($alphabet,$cur_pswd_ltr),0,strlen($this->ralphabet)); } $i = 0; $n = 0; $nn = strlen ( $this->password ); $c = strlen ( $strtoencrypt ); $encrypted_string = ''; while ( $i < $c ) { $encrypted_string .= substr ( $pos_alpha_ary[$n], strpos ( $this->ralphabet, substr($strtoencrypt, $i, 1 ) ), 1 ); $n++; if ( $n == $nn ) { $n = 0; } $i++; } return $encrypted_string; } function decrypt ( $strtodecrypt ) { if( !isset ( $this->password ) ) { return 'please supply a password'; } $alphabet = $this->ralphabet . $this->ralphabet; for ( $i=0; $i < strlen ( $this->password ); $i++ ) { $cur_pswd_ltr = substr ( $this->password, $i, 1 ); $pos_alpha_ary[] = substr ( strstr ( $alphabet, $cur_pswd_ltr), 0, strlen ( $this->ralphabet ) ); } $i = 0; $n = 0; $nn = strlen ( $this->password ); $c = strlen ( $strtodecrypt ); $decrypted_string = ''; while ( $i < $c ) { $decrypted_string .= substr ( $this->ralphabet, strpos ( $pos_alpha_ary[$n], substr ( $strtodecrypt, $i, 1) ), 1); $n++; if ( $n == $nn ) { $n = 0; } $i++; } $decrypted_string = str_replace("[tab]","\t", $decrypted_string); $decrypted_string = str_replace("[new]","\n", $decrypted_string); $decrypted_string = str_replace("[ret]","\r", $decrypted_string); return $decrypted_string; } function cryption_table () { if( !isset ( $this->password ) ) { return 'please supply a password'; } $alphabet = $this->ralphabet . $this->ralphabet; $table = ''; for( $i=0; $ipassword); $i++ ) { $cur_pswd_ltr = substr($this->password,$i,1); $pos_alpha_ary[] = substr(strstr($alphabet,$cur_pswd_ltr),0,strlen($alphabet)); } $table .= "\n"; $table .= ""; for( $j=0; $j < strlen ( $this->ralphabet ); $j++ ) { $ltr = substr ( $this->ralphabet, $j, 1 ); $table .= "\n"; } $table .= "\n\n"; for( $i=0; $i < count ( $pos_alpha_ary ); $i++ ) { $z = $i + 1; $table .= ""; for( $k=0; $k < strlen ( $pos_alpha_ary[$i] ); $k++ ) { $ltr = substr($pos_alpha_ary[$i],$k,1); $table .= "\n"; } $table .= "\n\n"; } $table .= "
$ltr
$z$ltr
\n"; return $table; } } // end class Crypto ?>