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_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); }