mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-31 04:28:51 +00:00
641b6d0ccb
Shared/Font is hardly covered in unit tests (as opposed to Style/Font which is completely covered). And it presented some good opportunities for code optimization. I wrote and tested the new unit tests first, then optimized the code and confirmed that everything still works. There is still a bit of a gap with "exact" measurements. I had tests ready, but had to withdraw them when I discovered they weren't quite portable (see https://github.com/php/php-src/issues/9073).
22 lines
675 B
PHP
22 lines
675 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xls;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Reader\Xls\RC4;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class Rc4Test extends TestCase
|
|
{
|
|
public function testRc4(): void
|
|
{
|
|
// following result confirmed at:
|
|
// https://cryptii.com/pipes/rc4-encryption
|
|
$key = "\x63\x72\x79\x70\x74\x69\x69";
|
|
$string = 'The quick brown fox jumps over the lazy dog.';
|
|
$rc4 = new RC4($key);
|
|
$result = bin2hex($rc4->RC4($string));
|
|
$expectedResult = '2ac2fecdd8fbb84638e3a4820eb205cc8e29c28b9d5d6b2ef974f311964971c90e8b9ca16467ef2dc6fc3520';
|
|
self::assertSame($expectedResult, $result);
|
|
}
|
|
}
|