Exemplo n.º 1
0
             }
         } else {
             $aesops->encryptCBC($key, $states, $results);
         }
         break;
     case "decrypt":
         if ($_POST['mode'] == 'ecb') {
             foreach ($states as $state) {
                 array_push($results, $aesops->decrypt($state, $key));
             }
         } else {
             $aesops->decryptCBC($key, $states, $results);
         }
         break;
     case "invSubBytes":
         $result = $aesops->invSubBytes($state);
         break;
     case "invShiftRows":
         $result = $aesops->invShiftRows($state);
         break;
     case "invMixColumns":
         $result = $aesops->invMixColumns($state);
         break;
     default:
         $_SESSION['debug'] .= "\n Error, operation not valid";
 }
 // now convert back the final state to output
 foreach ($results as $result) {
     $output .= $iop->convertStateToByteArray($result);
 }
 $_SESSION['debug'] .= "\n\nThe hexadecimal result of the " . $operation . " operation:\n{$output}\n";