示例#1
0
文件: EcDH.php 项目: sbwdlihao/phpecc
 /**
  * {@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.");
 }
示例#2
0
 /**
  * @param $content
  * @return int|string
  */
 private function hash($content)
 {
     $messages = new MessageFactory(MathAdapterFactory::getAdapter());
     return $messages->plaintext($content, 'sha256')->getHash();
 }