function crypto_dig1_ciphertext(WC_Challenge $chall) { WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true); $solution = WC_CryptoChall::generateSolution('The22_GHDIdiiiiEEEEZZ', true, true); $pt = $chall->lang('plaintext', array($solution)); $ct = crypto_dig1_encrypt($pt); return $ct; }
function crypto_trans1_ciphertext(WC_Challenge $chall) { WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true, true); $solution = WC_CryptoChall::generateSolution('The_GHSUBBBBEEEEZZ', true, true); $pt = $chall->lang('plaintext', array($solution)); $ct = crypto_trans1_encrypt($pt); $ct = str_replace(' ', ' ', $ct); return $ct; }
function crypto_caesar_1_ciphertext(WC_Challenge $chall) { WC_CryptoChall::checkPlaintext(strtoupper($chall->lang('plaintext'))); $solution = WC_CryptoChall::generateSolution('The Foo The Bar The Lee', true, true); $pt = $chall->lang('plaintext', array($solution)); $pt = strtoupper($pt); $pt = preg_replace('/[^A-Z ]/', '', $pt); $ct = crypto_caesar_1_encrypt($pt); return $ct; }
function crypto_caesar_2_ciphertext(WC_Challenge $chall) { WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true); $solution = WC_CryptoChall::generateSolution('The_Foo!The!Bar_The!Lee', true, true); $pt = $chall->lang('plaintext', array($solution)); // $pt = strtoupper($pt); // $pt = preg_replace('/[^A-Z]/', '', $pt); $ct = crypto_caesar_2_encrypt($pt); return WC_CryptoChall::hexdump($ct); }
function crypto_sub1_ciphertext(WC_Challenge $chall) { WC_CryptoChall::checkPlaintext(strtolower($chall->lang('plaintext')), true, true); $solution = WC_CryptoChall::generateSolution('The_GHEEEEZZ', true); // var_dump($solution); $chars1 = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); $chars2 = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); shuffle($chars1); shuffle($chars2); $map = array(); for ($i = 0; $i < 26; $i++) { $map[$chars1[$i]] = $chars2[$i]; } $pt = $chall->lang('plaintext', array($solution)); $pt = strtoupper($pt); $pt = preg_replace('/[^A-Z ]/', '', $pt); $ct = crypto_sub1_encrypt($pt, $map); return $ct; }
function crypto_sub2_ciphertext(WC_Challenge $chall) { WC_CryptoChall::checkPlaintext($chall->lang('plaintext'), true); $solution = WC_CryptoChall::generateSolution('The_GHttttttEEEEZZ', true, true); $chars1 = array(); for ($i = 0; $i < 256; $i++) { $chars1[] = chr($i); } $chars2 = array(); for ($i = 0; $i < 256; $i++) { $chars2[] = chr($i); } shuffle($chars1); shuffle($chars2); $map = array(); for ($i = 0; $i < 256; $i++) { $map[$chars1[$i]] = $chars2[$i]; } $pt = $chall->lang('plaintext', array($solution)); $ct = crypto_sub2_encrypt($pt, $map); return WC_CryptoChall::hexdump($ct); }