Раскодирование строки на основе ключа
    :param input_text: исходная строка
    :param secure_key: секретный ключ
    :return:
331441
def decode_jwt(input_text, secure_key):
    
    if input_text is None:
        return None

    encoded = (input_text.split(":")[1]).encode('utf-8')
    decoded = jwt.decode(encoded, secure_key)
    return decoded['sub']
901708
def set_secure(self, section, option, value):
        
        if self.keyring_available:
            s_option = "%s%s" % (section, option)
            self._unsaved[s_option] = ('set', value)
            value = self._secure_placeholder
        ConfigParser.set(self, section, option, value)
776423
def decryptPkmsg(self, ciphertext, textMsg=True):
        
        sessionRecord = self.sessionStore.loadSession(self.recipientId, self.deviceId)
        unsignedPreKeyId = self.sessionBuilder.process(sessionRecord, ciphertext)
        plaintext = self.decryptWithSessionRecord(sessionRecord, ciphertext.getWhisperMessage())

        # callback.handlePlaintext(plaintext)
        self.sessionStore.storeSession(self.recipientId, self.deviceId, sessionRecord)

        if unsignedPreKeyId is not None:
            self.preKeyStore.removePreKey(unsignedPreKeyId)

        return plaintext
957829
def submit(recaptcha_response, private_key, remoteip):
    
    params = urlencode({
        "secret": private_key,
        "response": recaptcha_response,
        "remoteip": remoteip,
    })

    if not PY2:
        params = params.encode("utf-8")

    response = recaptcha_request(params)
    data = json.loads(response.read().decode("utf-8"))
    response.close()
    return RecaptchaResponse(
        is_valid=data["success"],
        error_codes=data.get("error-codes")
    )
485031
def addsshkey(self, title, key):
        
        data = {'title': title, 'key': key}

        request = requests.post(
            self.keys_url, headers=self.headers, data=data,
            verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        if request.status_code == 201:
            return True
        else:
            return False
1090226
function encrypt($text, $keys, $sign_key = null)
    {
        try {
            foreach ($keys as $key) {
                $this->gpg->addEncryptKey($key->reference);
            }

            if ($sign_key) {
                $this->gpg->addSignKey($sign_key->reference, $sign_key->password);

                $res     = $this->gpg->encryptAndSign($text, true);
                $sigInfo = $this->gpg->getLastSignatureInfo();

                $this->last_sig_algorithm = $sigInfo->getHashAlgorithmName();

                return $res;
            }

            return $this->gpg->encrypt($text, true);
        }
        catch (Exception $e) {
            return $this->get_error_from_exception($e);
        }
    }
386317
def encrypt(message, key: nil)

      raise ArgumentError.new('The message argument is required.') if message.blank?
      raise ArgumentError.new('The key argument is required.')     if key.blank?

      cipher = OpenSSL::Cipher::AES.new(256, 'CBC')
      cipher.encrypt
      cipher.padding = aes_256_padding
      cipher.key     = key

      cipher.update(message)+cipher.final

    end
1170490
public static function decrypt($input, $secret = null) {
        // no input?
        if(!$input)
            return false;

        // decode
        $decoded = self::base64decode($input);
        if(!$decoded)
            return false;

        // output
        return Security::decrypt($decoded, md5(self::secret($secret)));
    }
1315143
def get_input(*args, secret=False, required=False, blank=False, **kwargs):
    

    while True:
        if secret:
            value = getpass.getpass(*args, **kwargs)
        else:
            value = input(*args, **kwargs)

        if blank:
            value = value if value else None

        if not required or value:
            break

    return value
527158
public static function decrypt($encrypted_text, $key)
    {
        $md5Key = md5($key);
        
        $decrypted_text = mcrypt_decrypt(
            MCRYPT_RIJNDAEL_256, 
             $md5Key, 
             base64_decode($encrypted_text), 
             MCRYPT_MODE_CBC, 
             md5($md5Key)
        );
        
        $trimmed_decryption = rtrim($decrypted_text, "\0");
        return $trimmed_decryption;
    }
981588
def gpg_interactive_input(self, sub_keys_number):
        
        deselect_sub_key = "key 0\n"

        _input = self._main_key_command()
        for sub_key_number in range(1, sub_keys_number + 1):
            _input += self._sub_key_command(sub_key_number) + deselect_sub_key
        return "%ssave\n" % _input
309698
public static function urlLink($text, $url, $parameters = [], $secure = null)
    {
        return $this->createElement('a')->text($text)
            ->href(url($url, $parameters, $secure));
    }
98500
def any_text_to_fernet_key(self, text):
        
        md5 = fingerprint.fingerprint.of_text(text)
        fernet_key = base64.b64encode(md5.encode("utf-8"))
        return fernet_key
331555
public static String hmacSha256(String input, String secretKey) {
        if (input == null) {
            throw new NullPointerException("input");
        } else if (secretKey == null) {
            throw new NullPointerException("secretKey");
        }
        return hmacSha256(input.getBytes(CHARSET_UTF8), secretKey.getBytes(CHARSET_UTF8));
    }
800765
def getCipherText(self, iv, key, plaintext):
        
        cipher = AESCipher(key, iv)
        return cipher.encrypt(bytes(plaintext))
370346
def key(self, user="", areq=None):
        
        csum = hashlib.new('sha224')
        csum.update(rndstr(32).encode('utf-8'))
        return csum.hexdigest()
167073
def secure_password(length=20, use_random=True):
    '''
    
    '''
    try:
        length = int(length)
        pw = ''
        while len(pw) < length:
            if HAS_RANDOM and use_random:
                while True:
                    try:
                        char = salt.utils.stringutils.to_str(get_random_bytes(1))
                        break
                    except UnicodeDecodeError:
                        continue
                pw += re.sub(
                    salt.utils.stringutils.to_str(r'\W'),
                    str(),  # future lint: disable=blacklisted-function
                    char
                )
            else:
                pw += random.SystemRandom().choice(string.ascii_letters + string.digits)
        return pw
    except Exception as exc:
        log.exception('Failed to generate secure passsword')
        raise CommandExecutionError(six.text_type(exc))