Encode (using the very insecure XOR)
@param string $input
@param string $secret Paranoia secret
@return boolean|string
974021
public static function encode($input, $secret = null) {
        // no input?
        if(!$input)
            return false;

        // run xor
        $xored = self::xor((string)$input, self::secret($secret));

        // output
        return self::base64encode($xored);
    }
643296
protected function decodeSingleHeader($input)
    {
        // For each encoded-word...
        while (preg_match('/(=\?([^?]+)\?(q|b)\?([^?]*)\?=)((\s+)=\?)?/i', $input, $matches)) {
            $encoded = $matches[1];
            $charset = $matches[2];
            $encoding = $matches[3];
            $text = $matches[4];
            $space = isset($matches[6]) ? $matches[6] : '';

            switch (strtolower($encoding)) {
                case 'b':
                    $text = $this->decodeContentTransfer($text, 'base64');
                    break;

                case 'q':
                    $text = str_replace('_', ' ', $text);
                    preg_match_all('/=([a-f0-9]{2})/i', $text, $matches);
                    foreach ($matches[1] as $value) {
                        $text = str_replace('='.$value, chr(hexdec($value)), $text);
                    }
                    break;
            }

            $text = $this->charset->decodeCharset($text, $this->charset->getCharsetAlias($charset));
            $input = str_replace($encoded.$space, $text, $input);
        }

        return $input;
    }
809792
private function encryptBlock($input, $key)
    {
        if (!$input && !$key) {
            return '';
        }

        $this->prepareCipher($key);
        $result = mcrypt_generic($this->mcrypt, $input);
        mcrypt_generic_deinit($this->mcrypt);

        return $result;
    }
625319
protected static function encodePart(&$input)
    {
        $codePoints = &static::codePoints($input);

        $n = static::INITIAL_N;
        $bias = static::INITIAL_BIAS;
        $delta = 0;
        $h = $b = count($codePoints['basic']);

        $output = static::getString($codePoints['basic']);

        if ($input === $output) {
            return $output;
        }

        if ($b > 0) {
            $output .= static::DELIMITER;
        }

        $codePoints['nonBasic'] = array_unique($codePoints['nonBasic']);
        sort($codePoints['nonBasic']);

        $i = 0;
        $length = $codePoints['length'];

        while ($h < $length) {
            $m = $codePoints['nonBasic'][$i++];
            $delta = $delta + ($m - $n) * ($h + 1);
            $n = $m;

            foreach ($codePoints['all'] as $c) {
                if ($c < $n || $c < static::INITIAL_N) {
                    $delta++;
                }
                if ($c === $n) {
                    $q = $delta;
                    for ($k = static::BASE;; $k += static::BASE) {
                        $t = static::calculateThreshold($k, $bias);

                        if ($q < $t) {
                            break;
                        }

                        $code = $t + (($q - $t) % (static::BASE - $t));
                        $output .= static::$encodeTable[$code];

                        $q = ($q - $t) / (static::BASE - $t);
                    }

                    $output .= static::$encodeTable[$q];
                    $bias = static::adapt($delta, $h + 1, ($h === $b));
                    $delta = 0;
                    $h++;
                }
            }

            $delta++;
            $n++;
        }

        return static::PREFIX . $output;
    }
784894
public static String encrypt(String input) {
        byte[] result = encrypt(input.getBytes());
        return new String(result);
    }
623389
public static function urlsafeB64Decode($input)
    {
        $remainder = strlen($input) % 4;

        if ($remainder) {
            $pad_length = 4 - $remainder;
            $input .= str_repeat('=', $pad_length);
        }

        return base64_decode(strtr($input, '-_', '+/'));
    }
1027659
public static function huffmanDecode(string $input) { /* : ?string */
        $lookup = self::$huffmanLookup;
        $len = \strlen($input);
        $out = \str_repeat("\0", $len / 5 * 8 + 1); // max length

        for ($off = $i = 0; $i < $len; $i++) {
            list($lookup, $chr) = $lookup[$input[$i]];

            if ($chr != null) {
                $out[$off++] = $chr;
                if (isset($chr[1])) {
                    $out[$off++] = $chr[1];
                    continue;
                }
                continue;
            }

            if ($chr === "") {
                return null;
            }
        }

        return \substr($out, 0, $off);
    }
157197
public function hash($input) {
		$hash = crypt($input, $this->getSalt());

		if(strlen($hash) > 13)
			return $hash;

		return false;
	}
420351
protected function md4Encrypt($input)
    {
        $input = $this->convertTo16bit($input);

        return function_exists('hash') ? hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input);
    }
1069957
public static function encryptPassword($input)
    {
        $rndStr=strtolower(self::getRandomString(32));
        $mixedStr=$rndStr.$input;
        return $rndStr.md5($mixedStr);
    }
325115
public static function decryptG($str, $secret = 'ePHP')
    {
        if (!$str) {
            return false;
        }

        $key = md5($secret . "30f7384ac1");

        $ciphertext_raw = \ePHP\Misc\Func::safe_b64decode($str);
        return openssl_decrypt($ciphertext_raw, 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
    }
1177690
protected function transformWalletPassword($input = '')
    {
        if (!\Genesis\Utils\Common::isBase64Encoded($input)) {
            return base64_encode($input);
        }

        return $input;
    }
1342463
protected function _base32Encode($secret, $padding = true)
    {
        if (empty($secret)) return '';

        $base32chars = $this->_getBase32LookupTable();

        $secret = str_split($secret);
        $binaryString = "";
        for ($i = 0; $i < count($secret); $i++) {
            $binaryString .= str_pad(base_convert(ord($secret[$i]), 10, 2), 8, '0', STR_PAD_LEFT);
        }
        $fiveBitBinaryArray = str_split($binaryString, 5);
        $base32 = "";
        $i = 0;
        while ($i < count($fiveBitBinaryArray)) {
            $base32 .= $base32chars[base_convert(str_pad($fiveBitBinaryArray[$i], 5, '0'), 2, 10)];
            $i++;
        }
        if ($padding && ($x = strlen($binaryString) % 40) != 0) {
            if ($x == 8) $base32 .= str_repeat($base32chars[32], 6);
            elseif ($x == 16) $base32 .= str_repeat($base32chars[32], 4);
            elseif ($x == 24) $base32 .= str_repeat($base32chars[32], 3);
            elseif ($x == 32) $base32 .= $base32chars[32];
        }
        return $base32;
    }
469944
public function encrypt($input)
    {
        if (! $input) {
            return $input;
        }

        $methods = $this->getEncryptionMethods();
        $method  = reset($methods);
        $mkey    = key($methods);

        if ('mcrypt' == $method) {
            $result = $this->encryptMcrypt($input);
        } elseif ('null' == $method) {
            $result = $input;
        } else {
            $result = $this->encryptOpenSsl($input, $method);
        }

        return ":$mkey:" . base64_encode($result);
    }
1052110
private function generateEncryptRequest(InputInterface $input, OutputInterface $output)
    {
        $algorithmId = $input->getArgument('algorithm_id');
        $plaintextValue = $input->getArgument('plaintext_value');
        $key = $input->getOption('key');
        $keyProvided = $input->hasParameterOption(['--key', '-k']);

        $questionText = 'Plaintext value to be encrypted (hidden input): ';
        $plaintextAsker = $this->questionAskerGenerator
            ->generateHiddenInputQuestionAsker($questionText, $input, $output);

        return $this->encryptRequestFactory
            ->createEncryptRequest($algorithmId, $key, $keyProvided, $plaintextAsker, $plaintextValue);
    }
621615
public static function jsonDecode($input)
    {
        $obj = json_decode($input);
        if (function_exists('json_last_error') && $errno = json_last_error()) {
            JWT::_handleJsonError($errno);
        } else if ($obj === null && $input !== 'null') {
            throw new \DomainException('Null result with non-null input');
        }
        return $obj;
    }
761282
protected function _uudecode($input)
    {
        $decoded = '';

        foreach (explode("\n", $input) as $line) {
            $c = count($bytes = unpack('c*', substr(trim($line,"\r\n\t"), 1)));

            while ($c % 4) {
                $bytes[++$c] = 0;
            }

            foreach (array_chunk($bytes, 4) as $b) {
                $b0 = ($b[0] == 0x60) ? 0 : $b[0] - 0x20;
                $b1 = ($b[1] == 0x60) ? 0 : $b[1] - 0x20;
                $b2 = ($b[2] == 0x60) ? 0 : $b[2] - 0x20;
                $b3 = ($b[3] == 0x60) ? 0 : $b[3] - 0x20;

                $b0 <<= 2;
                $b0 |= ($b1 >> 4) & 0x03;
                $b1 <<= 4;
                $b1 |= ($b2 >> 2) & 0x0F;
                $b2 <<= 6;
                $b2 |= $b3 & 0x3F;

                $decoded .= pack('c*', $b0, $b1, $b2);
            }
        }

        return rtrim($decoded, "\0");
    }