function decode($encryptedText, $key) { $decodedText = ""; $alphabetTemplate = "abcdefghiklmnopqrstuvwxyz"; $cipherTable = tableMaker($key); for ($i = 0; $i < strlen($encryptedText) - 1; $i += 2) { $pair = textPairing($encryptedText, $i); $match = decodeMatch($pair, $cipherTable); $decodedText .= $match; } return $decodedText; }
function decode($encryptedText, $key) { $decodedText = ""; $cleanText = clean($encryptedText); $vKeyLength = getTextLength($cleanText); $vKey = getVKey($key, $vKeyLength); $counter = 0; for ($i = 0; $i < strlen($encryptedText); $i++) { if (ord($encryptedText[$i]) >= 97 && ord($encryptedText[$i]) <= 122) { $match = decodeMatch($vKey[$counter++], $encryptedText[$i]); $decodedText .= $match; } else { $decodedText .= $encryptedText[$i]; } } return $decodedText; }