/** * @dataProvider provideRfcSha512 */ public function testRfc6238ComplianceWithSha512($unixTimestamp, $code) { $generator = new TimeBasedCodeGenerator('sha512'); $key = '1234567890123456789012345678901234567890123456789012345678901234'; $timestamp = \DateTime::createFromFormat('U', $unixTimestamp); $this->assertEquals($code, $generator->generateCode($key, 8, $timestamp)); }
/** * {@inherited} */ public function generateCode($key, $length = 6, \DateTime $timestamp = null) { $decodedKey = $this->base32encoder->decode($key); return parent::generateCode($decodedKey, $length, $timestamp); }