public function encryptMessage($input)
    {
        $input = (string)$input;
        
        $calgo = $this->config->getCipherAlgorithm();
        $cmode = $this->config->getCipherMode();
        $malgo = $this->config->getHmacAlgorithm();
        
        $size = mcrypt_get_iv_size($calgo, $cmode);
        $keySize = mcrypt_get_key_size($calgo, $cmode);
        $blockSize = mcrypt_get_block_size($calgo, $cmode);
        $hmacSize = strlen(hash_hmac($malgo, '', 'foo-key', true));
        
        $iv = random_bytes($size);
        $key = $this->computeCipherKey($this->config->getCipherKey(), $keySize, $iv);
        
        // PKCS7 Padding
        $pad = $blockSize - (strlen($input) % $blockSize);
        $input .= str_repeat(chr($pad), $pad);
        
        $cipherText = $iv . mcrypt_encrypt($calgo, $key, $input, $cmode, $iv);
        
        return $cipherText . hash_hmac($malgo, $cipherText, $this->computeCipherKey($this->config->getHmacKey(), $hmacSize, $iv), true);
    }