Ejemplo n.º 1
0
 /**
  * {@inheritDoc}
  * @see \Mdanter\Ecc\Crypto\EcDH\EcDHInterface::decryptFile()
  */
 public function decryptFile($path)
 {
     if (file_exists($path) && is_readable($path)) {
         $cipherText = $this->messages->ciphertext(file_get_contents($path));
         return $cipherText;
     }
     throw new \InvalidArgumentException("File '{$path}' does not exist or is not readable.");
 }
Ejemplo n.º 2
0
 /**
  * @param $content
  * @return int|string
  */
 private function hash($content)
 {
     $messages = new MessageFactory(MathAdapterFactory::getAdapter());
     return $messages->plaintext($content, 'sha256')->getHash();
 }