function yk_e($a, $c) { for ($f = 0, $i, $e = '', $h = 0; 256 > $h; $h++) { $b[$h] = $h; } for ($h = 0; 256 > $h; $h++) { $f = ($f + $b[$h] + charCodeAt($a, $h % strlen($a))) % 256; $i = $b[$h]; $b[$h] = $b[$f]; $b[$f] = $i; } for ($q = $f = $h = 0; $q < strlen($c); $q++) { $h = ($h + 1) % 256; $f = ($f + $b[$h]) % 256; $i = $b[$h]; $b[$h] = $b[$f]; $b[$f] = $i; $e .= fromCharCode(charCodeAt($c, $q) ^ $b[($b[$h] + $b[$f]) % 256]); } return $e; }
/** * Rehydrate the text in a diff from a string of line hashes to real lines of * text. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. * @param {Array.<string>} lineArray Array of unique strings. * @private */ function diff_charsToLines(&$diffs, $lineArray) { for ($x = 0; $x < count($diffs); $x++) { $chars = $diffs[$x][1]; $text = array(); for ($y = 0; $y < strlen($chars); $y++) { $text[$y] = $lineArray[charCodeAt($chars, $y)]; } $diffs[$x][1] = implode('', $text); } }