public function generateHmac($string) { if (!is_string($string)) { throw new InvalidArgumentForHashGenerationException('A hash can only be generated for a string, but "' . gettype($string) . '" was given.', 1255069587); } return hash_hmac('sha1', $string, $this->getEncryptionKey()); }
/** * @test */ public function generatedHashReturnsAHashOf40Characters() { $hash = $this->hashService->generateHmac('asdf'); $this->assertSame(40, strlen($hash)); }