/** * {@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."); }
/** * @param $content * @return int|string */ private function hash($content) { $messages = new MessageFactory(MathAdapterFactory::getAdapter()); return $messages->plaintext($content, 'sha256')->getHash(); }