/** * Generate an HOTP value. * * @link http://tools.ietf.org/html/rfc4226#section-5.3 * * @param HotpConfigurationInterface $configuration The configuration to use for generation. * @param CounterBasedOtpSharedParametersInterface $shared The shared parameters to use for generation. * * @return HotpValueInterface The generated HOTP value. */ public function generateHotp(HotpConfigurationInterface $configuration, CounterBasedOtpSharedParametersInterface $shared) { return new HotpValue(hash_hmac($configuration->algorithm()->value(), $this->pack($shared->counter()), $shared->secret(), true)); }