ray[$i]+$dwordObject->bitArray[$i] != 0 ) $res->SetBit( 1, $i ); else $res->SetBit( 0, $i ); } return $res; } function BitwiseAND( $dwordObject ) { $res = new DWord(); for( $i=0; $i<=31; $i++ ) $res->SetBit( $this->bitArray[$i]*$dwordObject->bitArray[$i], $i ); return $res; } function BitwiseXOR( $dwordObject ) { $res = new DWord(); for( $i=0; $i<=31; $i++ ) { if ($this->bitArray[$i] == $dwordObject->bitArray[$i]) $res->SetBit( 1, $i ); else $res->SetBit( 0, $i ); } return $res; } function Plus( $dwordObject ) { $res = new DWord(); $cf = 0; for( $i=0; $i<=3; $i++ ) { $byte1 = $this->_getByte( $i*8 ); $byte2 = $dwordObject->_getByte( $i*8 ); $res->_setByte( $byte1 + $byte2 + $cf, $i*8 ); if ( $byte1 + $byte2 + $cf >= 256 ) $cf = 1; } return $res; } } // ***************************************************************************** // Purpose encrypts cc_number field ( see ORDERS_TABLE in database_structure.xml ) // Inputs // Remarks // Returns function cryptCCNumberCrypt( $cc_number, $key ) { return base64_encode($cc_number); /* $res = ""; $strlen = strlen( $cc_number ); for( $i=1; $i<=32-$strlen; $i++ ) $cc_number .= " "; $res .= chr( $strlen ); $dWordArray = array(); for( $i=1; $i<=8; $i++ ) { $dWordObject = DWord(); $dWordObject->SetValue( $cc_number[ ($i-1)*4 + 0 ], $cc_number[ ($i-1)*4 + 1 ], $cc_number[ ($i-1)*4 + 2 ], $cc_number[ ($i-1)*4 + 3 ] ); $dWordArray[] = $dWordObject; } $dWordArrayCifered = array(); for( $i=1; $i<=4; $i++ ) { $ciferedData = _gostCrypt( array( $dWordArray[($i-1)*2], $dWordArray[($i-1)*2 + 1]), $key ); $dWordArrayCifered[] = $ciferedData[0]; $dWordArrayCifered[] = $ciferedData[1]; } foreach( $dWordArrayCifered as $dWordCifered ) { $byte1 = 0; $byte2 = 0; $byte3 = 0; $byte4 = 0; $dWordCifered->GetValue( &$byte1, &$byte2, &$byte3, &$byte4 ); $res .= chr($byte1); $res .= chr($byte2); $res .= chr($byte3); $res .= chr($byte4); } return $res; */ } // ***************************************************************************** // Purpose decrypts cc_number field ( see ORDERS_TABLE in database_structure.xml ) // Inputs // Remarks // Returns function cryptCCNumberDeCrypt( $cifer, $key ) { return base64_decode($cifer); /* $res = ""; $strlen = (int)($cifer[0]); $dWordArray = array(); for( $i=1; $i<=8; $i++ ) { $dWordObject = DWord(); $dWordObject->SetValue( $cifer[ ($i-1)*4 + 1 ], $cifer[ ($i-1)*4 + 2 ], $cifer[ ($i-1)*4 + 3 ], $cifer[ ($i-1)*4 + 4 ] ); $dWordArray[] = $dWordObject; } $dWordArrayDeCifered = array(); for( $i=1; $i<=4; $i++ ) { $deCiferedData = _gostDeCrypt( array( $dWordArray[($i-1)*2], $dWordArray[($i-1)*2 + 1]), $key ); $dWordArrayCifered[] = $deCiferedData[0]; $dWordArrayCifered[] = $deCiferedData[1]; } foreach( $dWordArrayCifered as $dWordCifered ) { $byte1 = 0; $byte2 = 0; $byte3 = 0; $byte4 = 0; $dWordCifered->GetValue( &$byte1, &$byte2, &$byte3, &$byte4 ); $res .= chr($byte1); $res .= chr($byte2); $res .= chr($byte3); $res .= chr($byte4); } $temp = $res; for( $i=1; $i<=$strlen; $i++ ) $res .= $temp[$i-1]; return $res; */ } // ***************************************************************************** // Purpose encrypts cc_holdername field ( see ORDERS_TABLE in database_structure.xml ) // Inputs // Remarks // Returns function cryptCCHoldernameCrypt( $cc_holdername, $key ) { return base64_encode( $cc_holdername ); } // ***************************************************************************** // Purpose decrypts cc_holdername field ( see ORDERS_TABLE in database_structure.xml ) // Inputs // Remarks // Returns function cryptCCHoldernameDeCrypt( $cifer, $key ) { return base64_decode( $cifer ); } // ***************************************************************************** // Purpose encrypts cc_expires field ( see ORDERS_TABLE in database_structure.xml ) // Inputs // Remarks // Returns function cryptCCExpiresCrypt( $cc_expires, $key ) { return base64_encode( $cc_expires ); } // ***************************************************************************** // Purpose decrypts cc_expires field ( see ORDERS_TABLE in database_structure.xml ) // Inputs // Remarks // Returns function cryptCCExpiresDeCrypt( $cifer, $key ) { return base64_decode( $cifer ); } // ***************************************************************************** // Purpose encrypts customer ( and admin ) password field // ( see ORDERS_TABLE in database_structure.xml ) // Inputs // Remarks // Returns function cryptPasswordCrypt( $password, $key ) { return base64_encode( $password ); } // ***************************************************************************** // Purpose decrypts customer ( and admin ) password field ( see ORDERS_TABLE in database_structure.xml ) // Inputs // Remarks // Returns function cryptPasswordDeCrypt( $cifer, $key ) { return base64_decode( $cifer ); } // ***************************************************************************** // Purpose encrypts getFileParam // Inputs // Remarks see also get_file.php // Returns function cryptFileParamCrypt( $getFileParam, $key ) { return base64_encode( $getFileParam ); } // ***************************************************************************** // Purpose decrypt getFileParam // Inputs // Remarks see also get_file.php // Returns function cryptFileParamDeCrypt( $cifer, $key ) { return base64_decode( $cifer ); } //-------------------------------------- // initialize // it is single byte values $bK8 = array( 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 ); $bK7 = array( 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 ); $bK6 = array( 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 ); $bK5 = array( 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 ); $bK4 = array( 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 ); $bK3 = array( 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 ); $bK2 = array( 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 ); $bK1 = array( 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 ); // it is single byte values $bK87 = array(); $bK65 = array(); $bK43 = array(); $bK21 = array(); for ($i=0; $i<256; $i++) { $bK87[$i] = $bK8[$i >> 4] << 4 | $bK7[$i