/** * Tests the conversion of a hexadecimal string into a string. * * @dataProvider hexToStringProvider * @covers empire\framework\util\Math::hexToString * * @param string $hex the hexadecimal string * @param string $res the resulting string */ public function testHexToString($hex, $res) { $this->assertSame($res, Math::hexToString($hex)); }
/** * Provides test data for the hash calculation test. * * @return array the test data */ public function calculateHMACProvider() { $res = array(); $res[] = array(Math::hexToString(''), Math::hexToString(''), '74e6f7298a9c2d168935f58c001bad88'); $res[] = array('The quick brown fox jumps over the lazy dog', 'key', '80070713463e7749b90c2dc24911e275'); return $res; }
/** * Provides test data for the hash calculation test. * * @return array the test data */ public function calculateHMACProvider() { $res = array(); $res[] = array(Math::hexToString('4869205468657265'), Math::hexToString('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'), 'b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7'); $res[] = array(Math::hexToString('7768617420646f2079612077616e7420666f72206e6f7468696e673f'), Math::hexToString('4a656665'), '5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843'); return $res; }
/** * Provides test data for the hash calculation test. * * @return array the test data */ public function calculateHMACProvider() { $res = array(); $res[] = array(Math::hexToString('4869205468657265'), Math::hexToString('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'), '87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854'); $res[] = array(Math::hexToString('7768617420646f2079612077616e7420666f72206e6f7468696e673f'), Math::hexToString('4a656665'), '164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737'); return $res; }