예제 #1
0
파일: EcDH.php 프로젝트: sbwdlihao/phpecc
 /**
  * {@inheritDoc}
  * @see \Mdanter\Ecc\Crypto\EcDH\EcDHInterface::encryptFile()
  */
 public function encryptFile($path)
 {
     if (file_exists($path) && is_readable($path)) {
         $message = $this->messages->plaintext(file_get_contents($path), 'sha256');
         return $this->encrypt($message);
     }
     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();
 }