Returns the encrypted value of the data
358216
def encrypt(data)
      Digest::const_get(algorithm.upcase).hexdigest(build(data, salt))
    end
530424
def Encrypt(self, data):
    """"""
    encryptor = self.GetEncryptor()
    padded_data = self.Pad(data)

    try:
      return encryptor.update(padded_data) + encryptor.finalize()
    except ValueError as e:
      raise CipherError(e)
527512
def encrypt(data)
      cipher = build_cipher(:encrypt)
      [cipher.update(data) + cipher.final].pack('m')
    end
101338
public function encrypt($data): string
    {
        if (!$this->password)
        {
            return JSON::encode($data);
        }

        return $this->security()
            ->encrypt(JSON::encode($data));
    }
774480
def encrypt_seal(self, data: Union[str, bytes]) -> bytes:
        
        curve25519_public_key = libnacl.crypto_sign_ed25519_pk_to_curve25519(self.pk)
        return libnacl.crypto_box_seal(ensure_bytes(data), curve25519_public_key)
1036798
public function encryptData($data)
    {
        if ($this->cryptParams['library'] === 'openssl') {
            switch ($this->cryptParams['type']) {
                case 'symmetric':
                    return $this->encryptSymmetric($data);
                case 'public':
                    return $this->encryptPublic($data);
                case 'private':
                    return $this->encryptPrivate($data);
            }
        }
    }
734641
def Decrypt(self, encrypted_data):
    
    index_split = -(len(encrypted_data) % Blowfish.block_size)
    if index_split:
      remaining_encrypted_data = encrypted_data[index_split:]
      encrypted_data = encrypted_data[:index_split]
    else:
      remaining_encrypted_data = b''

    decrypted_data = self._blowfish_cipher.decrypt(encrypted_data)

    return decrypted_data, remaining_encrypted_data
1042088
def decrypt(data, opts={})
      data = data.to_s
      raise "No private key set!" unless @key.private?
      unless opts[:binary]
        data = Base64.decode64(data)
      end
      @key.private_decrypt(data)
    end
1256586
def encrypt(self, data):
        
        if False in six.itervalues(self.ready):
            raise CipherError(data)
        encryptor = self._cipher.encryptor()
        tmp = encryptor.update(data) + encryptor.finalize()
        self.iv = tmp[-self.block_size:]
        return tmp
1182358
public byte[] encrypt(byte[] data) {
		lock.lock();
		try {
			if (null == this.params) {
				cipher.init(Cipher.ENCRYPT_MODE, secretKey);
			} else {
				cipher.init(Cipher.ENCRYPT_MODE, secretKey, params);
			}
			return cipher.doFinal(data);
		} catch (Exception e) {
			throw new CryptoException(e);
		} finally {
			lock.unlock();
		}
	}
1202502
function containsEncryptedData(obj) {
    var foundEncrypted = false;
    if (_.isString(obj)) {
        foundEncrypted = isEncrypted(obj);
    } else if (_.isArray(obj)) {
        for (var i = 0; i < obj.length; i++) {
            foundEncrypted = foundEncrypted || containsEncryptedData(obj[i]);
        }
    } else if (_.isObject(obj)) {
        for (var key in obj) {
            foundEncrypted = foundEncrypted || containsEncryptedData(obj[key]);
        }
    }

    return foundEncrypted;
}
1160687
def encrypt(self, raw):
        
        raw = self._pad(raw)
        iv = Random.new().read(AES.block_size)
        cipher = AES.new(self.key, AES.MODE_CBC, iv)
        return base64.urlsafe_b64encode(iv + cipher.encrypt(raw))
1295903
def encrypted_json(self):
        
        json = serialize(objects=[self.instance])
        encrypted_json = Cryptor().aes_encrypt(json, LOCAL_MODE)
        return encrypted_json
692698
def getData4cryptID(self, tablename, ID):
		""""""
			   
		fields = self._getFieldsInDB(tablename)
		
		SQL = 'SELECT *,MAKETIME(0,0,TIMESTAMPDIFF(SECOND, StartDate, EndDate)),DATE_ADD(EndDate, INTERVAL %s DAY),TIMESTAMPDIFF(DAY,DATE_ADD(EndDate, INTERVAL %s DAY), NOW()),TIMESTAMPDIFF(HOUR,DATE_ADD(EndDate, INTERVAL %s DAY), NOW()) FROM %s WHERE cryptID="%s"' % (self.store_time, self.store_time, self.store_time, tablename, ID)
		
		array_data = self.execQuery(SQL)
		
		if len(array_data) > 0:
			for x in range( len(fields) ):
				self.data[fields[x]] = array_data[0][x]
			self.data['date_expiration']  = array_data[0][-3]
			time_expiration = None
			if array_data[0][-2] and array_data[0][-1]:
				time_expiration = "%d days, %d hours" % (abs(array_data[0][-2]),abs(array_data[0][-1]) - abs(array_data[0][-2] * 24))			
			self.data['time_expiration']  = time_expiration
			self.data['time_computation'] = array_data[0][-4]
						 
		return self.data
291564
def encrypt(self, value):
        """"""
        timestamp = str(int(time.time()))
        value = base64.b64encode(value.encode(self.encoding))
        signature = create_signature(self.secret, value + timestamp.encode(),
                                     encoding=self.encoding)
        return "|".join([value.decode(self.encoding), timestamp, signature])
1194392
public byte[] decryptData(byte[] data) throws SymmetricKeyException {
        if (data.length < IV_SIZE)
            throw new SymmetricKeyException("Invalid encrypted data, no IV prepended");
        byte[] iv = ArrayUtils.subarray(data, 0, IV_SIZE);
        Cipher cipher = getCipher(Cipher.DECRYPT_MODE, iv);
        try {
            return cipher.doFinal(data, iv.length, data.length - iv.length);
        } catch (Exception e) {
            throw new SymmetricKeyException(e);
        }
    }
1185580
def encrypt(data, digest=True):
    """"""
    alg = get_best_algorithm()
    enc = implementations["encryption"][alg](
        data, implementations["get_key"]()
    )
    return "%s$%s" % (alg, (_to_hex_digest(enc) if digest else enc))