/trunk/vendor/autoload.php |
---|
3,22 → 3,9 |
// autoload.php @generated by Composer |
if (PHP_VERSION_ID < 50600) { |
if (!headers_sent()) { |
header('HTTP/1.1 500 Internal Server Error'); |
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; |
exit(1); |
} |
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; |
if (!ini_get('display_errors')) { |
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
fwrite(STDERR, $err); |
} elseif (!headers_sent()) { |
echo $err; |
} |
} |
trigger_error( |
$err, |
E_USER_ERROR |
); |
} |
require_once __DIR__ . '/composer/autoload_real.php'; |
/trunk/vendor/composer/ClassLoader.php |
---|
42,9 → 42,6 |
*/ |
class ClassLoader |
{ |
/** @var \Closure(string):void */ |
private static $includeFile; |
/** @var ?string */ |
private $vendorDir; |
109,7 → 106,6 |
public function __construct($vendorDir = null) |
{ |
$this->vendorDir = $vendorDir; |
self::initializeIncludeClosure(); |
} |
/** |
429,8 → 425,7 |
public function loadClass($class) |
{ |
if ($file = $this->findFile($class)) { |
$includeFile = self::$includeFile; |
$includeFile($file); |
includeFile($file); |
return true; |
} |
560,14 → 555,6 |
return false; |
} |
/** |
* @return void |
*/ |
private static function initializeIncludeClosure() |
{ |
if (self::$includeFile !== null) { |
return; |
} |
/** |
577,9 → 564,9 |
* |
* @param string $file |
* @return void |
* @private |
*/ |
self::$includeFile = \Closure::bind(static function($file) { |
function includeFile($file) |
{ |
include $file; |
}, null, null); |
} |
} |
/trunk/vendor/composer/InstalledVersions.php |
---|
98,7 → 98,7 |
{ |
foreach (self::getInstalled() as $installed) { |
if (isset($installed['versions'][$packageName])) { |
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; |
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); |
} |
} |
119,7 → 119,7 |
*/ |
public static function satisfies(VersionParser $parser, $packageName, $constraint) |
{ |
$constraint = $parser->parseConstraints((string) $constraint); |
$constraint = $parser->parseConstraints($constraint); |
$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
return $provided->matches($constraint); |
328,9 → 328,7 |
if (isset(self::$installedByVendor[$vendorDir])) { |
$installed[] = self::$installedByVendor[$vendorDir]; |
} elseif (is_file($vendorDir.'/composer/installed.php')) { |
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ |
$required = require $vendorDir.'/composer/installed.php'; |
$installed[] = self::$installedByVendor[$vendorDir] = $required; |
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
self::$installed = $installed[count($installed) - 1]; |
} |
342,17 → 340,12 |
// only require the installed.php file if this file is loaded from its dumped location, |
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
if (substr(__DIR__, -8, 1) !== 'C') { |
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ |
$required = require __DIR__ . '/installed.php'; |
self::$installed = $required; |
self::$installed = require __DIR__ . '/installed.php'; |
} else { |
self::$installed = array(); |
} |
} |
if (self::$installed !== array()) { |
$installed[] = self::$installed; |
} |
return $installed; |
} |
/trunk/vendor/composer/LICENSE |
---|
1,3 → 1,4 |
Copyright (c) Nils Adermann, Jordi Boggiano |
Permission is hereby granted, free of charge, to any person obtaining a copy |
17,3 → 18,4 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
THE SOFTWARE. |
/trunk/vendor/composer/autoload_files.php |
---|
6,6 → 6,6 |
$baseDir = dirname($vendorDir); |
return array( |
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', |
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php', |
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', |
); |
/trunk/vendor/composer/autoload_psr4.php |
---|
10,6 → 10,7 |
'bb\\Sha3\\' => array($vendorDir . '/danielmarschall/php-sha3/src'), |
'ViaThinkSoft\\Glip\\' => array($vendorDir . '/danielmarschall/glip/src'), |
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), |
'SpomkyLabs\\' => array($vendorDir . '/spomky-labs/php-punycode/src'), |
'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'), |
'MatthiasMullie\\PathConverter\\' => array($vendorDir . '/matthiasmullie/path-converter/src'), |
'MatthiasMullie\\Minify\\' => array($vendorDir . '/matthiasmullie/minify/src'), |
/trunk/vendor/composer/autoload_real.php |
---|
33,18 → 33,25 |
$loader->register(true); |
$filesToLoad = \Composer\Autoload\ComposerStaticInitOidPlusComposer::$files; |
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) { |
$includeFiles = \Composer\Autoload\ComposerStaticInitOidPlusComposer::$files; |
foreach ($includeFiles as $fileIdentifier => $file) { |
composerRequireOidPlusComposer($fileIdentifier, $file); |
} |
return $loader; |
} |
} |
/** |
* @param string $fileIdentifier |
* @param string $file |
* @return void |
*/ |
function composerRequireOidPlusComposer($fileIdentifier, $file) |
{ |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { |
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; |
require $file; |
} |
}, null, null); |
foreach ($filesToLoad as $fileIdentifier => $file) { |
$requireFile($fileIdentifier, $file); |
} |
return $loader; |
} |
} |
/trunk/vendor/composer/autoload_static.php |
---|
7,8 → 7,8 |
class ComposerStaticInitOidPlusComposer |
{ |
public static $files = array ( |
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', |
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php', |
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', |
); |
public static $prefixLengthsPsr4 = array ( |
27,6 → 27,7 |
'S' => |
array ( |
'Symfony\\Polyfill\\Mbstring\\' => 26, |
'SpomkyLabs\\' => 11, |
), |
'P' => |
array ( |
60,6 → 61,10 |
array ( |
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', |
), |
'SpomkyLabs\\' => |
array ( |
0 => __DIR__ . '/..' . '/spomky-labs/php-punycode/src', |
), |
'ParagonIE\\ConstantTime\\' => |
array ( |
0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src', |
/trunk/vendor/composer/installed.json |
---|
392,18 → 392,18 |
"source": { |
"type": "git", |
"url": "https://github.com/danielmarschall/uuid_mac_utils.git", |
"reference": "ba81df1a9ff2b883ba28741abe8fa147061d424e" |
"reference": "4a4fbab31b474f8025aa213641e99b9354192086" |
}, |
"dist": { |
"type": "zip", |
"url": "https://api.github.com/repos/danielmarschall/uuid_mac_utils/zipball/ba81df1a9ff2b883ba28741abe8fa147061d424e", |
"reference": "ba81df1a9ff2b883ba28741abe8fa147061d424e", |
"url": "https://api.github.com/repos/danielmarschall/uuid_mac_utils/zipball/4a4fbab31b474f8025aa213641e99b9354192086", |
"reference": "4a4fbab31b474f8025aa213641e99b9354192086", |
"shasum": "" |
}, |
"require": { |
"php": ">=7.0" |
}, |
"time": "2023-09-24T21:36:15+00:00", |
"time": "2023-10-06T21:40:12+00:00", |
"default-branch": true, |
"type": "library", |
"installation-source": "dist", |
837,12 → 837,12 |
"source": { |
"type": "git", |
"url": "https://github.com/phpseclib/phpseclib.git", |
"reference": "c5b4d08669b87c89bf14af74bdee14d5aa997e03" |
"reference": "967210fb469c1cb335900dda9092e4594bdf12ea" |
}, |
"dist": { |
"type": "zip", |
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c5b4d08669b87c89bf14af74bdee14d5aa997e03", |
"reference": "c5b4d08669b87c89bf14af74bdee14d5aa997e03", |
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/967210fb469c1cb335900dda9092e4594bdf12ea", |
"reference": "967210fb469c1cb335900dda9092e4594bdf12ea", |
"shasum": "" |
}, |
"require": { |
860,7 → 860,7 |
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", |
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." |
}, |
"time": "2023-09-25T15:56:47+00:00", |
"time": "2023-10-07T23:25:46+00:00", |
"type": "library", |
"installation-source": "dist", |
"autoload": { |
976,6 → 976,67 |
"install-path": "../spamspan/spamspan" |
}, |
{ |
"name": "spomky-labs/php-punycode", |
"version": "dev-master", |
"version_normalized": "dev-master", |
"source": { |
"type": "git", |
"url": "https://github.com/Spomky-Labs/php-punycode.git", |
"reference": "d12fe5cd18acedc79851ddc8effd7767d00485f1" |
}, |
"dist": { |
"type": "zip", |
"url": "https://api.github.com/repos/Spomky-Labs/php-punycode/zipball/d12fe5cd18acedc79851ddc8effd7767d00485f1", |
"reference": "d12fe5cd18acedc79851ddc8effd7767d00485f1", |
"shasum": "" |
}, |
"require": { |
"php": ">=5.4", |
"symfony/polyfill-mbstring": "^1.1" |
}, |
"require-dev": { |
"phpunit/phpunit": "^4.8|^5.0", |
"satooshi/php-coveralls": "^1.0" |
}, |
"time": "2016-04-29T13:09:14+00:00", |
"default-branch": true, |
"type": "library", |
"installation-source": "dist", |
"autoload": { |
"psr-4": { |
"SpomkyLabs\\": "src/" |
} |
}, |
"notification-url": "https://packagist.org/downloads/", |
"license": [ |
"MIT" |
], |
"authors": [ |
{ |
"name": "Renan Gonçalves", |
"email": "renan.saddam@gmail.com" |
}, |
{ |
"name": "Florent Morselli" |
}, |
{ |
"name": "All contributors", |
"homepage": "https://github.com/Spomky-Labs/oauth2-server-library/contributors" |
} |
], |
"description": "A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)", |
"homepage": "https://github.com/spomky-labs/php-punycode", |
"keywords": [ |
"idna", |
"punycode" |
], |
"support": { |
"issues": "https://github.com/Spomky-Labs/php-punycode/issues", |
"source": "https://github.com/Spomky-Labs/php-punycode/tree/master" |
}, |
"install-path": "../spomky-labs/php-punycode" |
}, |
{ |
"name": "symfony/polyfill-mbstring", |
"version": "v1.19.0", |
"version_normalized": "1.19.0.0", |
/trunk/vendor/composer/installed.php |
---|
95,7 → 95,7 |
'danielmarschall/uuid_mac_utils' => array( |
'pretty_version' => 'dev-master', |
'version' => 'dev-master', |
'reference' => 'ba81df1a9ff2b883ba28741abe8fa147061d424e', |
'reference' => '4a4fbab31b474f8025aa213641e99b9354192086', |
'type' => 'library', |
'install_path' => __DIR__ . '/../danielmarschall/uuid_mac_utils', |
'aliases' => array( |
189,7 → 189,7 |
'phpseclib/phpseclib' => array( |
'pretty_version' => '3.0.x-dev', |
'version' => '3.0.9999999.9999999-dev', |
'reference' => 'c5b4d08669b87c89bf14af74bdee14d5aa997e03', |
'reference' => '967210fb469c1cb335900dda9092e4594bdf12ea', |
'type' => 'library', |
'install_path' => __DIR__ . '/../phpseclib/phpseclib', |
'aliases' => array(), |
213,6 → 213,17 |
'aliases' => array(), |
'dev_requirement' => false, |
), |
'spomky-labs/php-punycode' => array( |
'pretty_version' => 'dev-master', |
'version' => 'dev-master', |
'reference' => 'd12fe5cd18acedc79851ddc8effd7767d00485f1', |
'type' => 'library', |
'install_path' => __DIR__ . '/../spomky-labs/php-punycode', |
'aliases' => array( |
0 => '9999999-dev', |
), |
'dev_requirement' => false, |
), |
'symfony/polyfill-mbstring' => array( |
'pretty_version' => 'v1.19.0', |
'version' => '1.19.0.0', |
/trunk/vendor/danielmarschall/uuid_mac_utils/includes/uuid_utils.inc.php |
---|
3,7 → 3,7 |
/* |
* UUID utils for PHP |
* Copyright 2011 - 2023 Daniel Marschall, ViaThinkSoft |
* Version 2023-09-24 |
* Version 2023-10-06 |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
1323,21 → 1323,24 |
if (($namespace_uuid ?? '') === '') throw new Exception("Namespace UUID missing"); |
if (!uuid_valid($namespace_uuid)) throw new Exception("Invalid namespace UUID '$namespace_uuid'"); |
$uuid1 = uuid_valid($hash_algo) ? hex2bin(str_replace('-','',uuid_canonize($hash_algo))) : ''; |
$uuid1 = uuid_valid($hash_algo) ? hex2bin(str_replace('-','',uuid_canonize($hash_algo))) : ''; // old "hash space" concept (dropped in Internet Draft 12) |
$uuid2 = hex2bin(str_replace('-','',uuid_canonize($namespace_uuid))); |
$payload = $uuid1 . $uuid2 . $name; |
if (uuid_valid($hash_algo)) { |
foreach (get_uuidv8_hash_space_ids() as list($algo,$space,$friendlyName,$author,$available)) { |
if (uuid_equal($hash_algo,$space)) { |
if (!$available) { |
throw new Exception("Algorithm $algo is not available on this system (PHP version too old)"); |
if (uuid_equal($hash_algo, '59031ca3-fbdb-47fb-9f6c-0f30e2e83145')) $hash_algo = 'sha224'; |
if (uuid_equal($hash_algo, '3fb32780-953c-4464-9cfd-e85dbbe9843d')) $hash_algo = 'sha256'; |
if (uuid_equal($hash_algo, 'e6800581-f333-484b-8778-601ff2b58da8')) $hash_algo = 'sha384'; |
if (uuid_equal($hash_algo, '0fde22f2-e7ba-4fd1-9753-9c2ea88fa3f9')) $hash_algo = 'sha512'; |
if (uuid_equal($hash_algo, '003c2038-c4fe-4b95-a672-0c26c1b79542')) $hash_algo = 'sha512/224'; |
if (uuid_equal($hash_algo, '9475ad00-3769-4c07-9642-5e7383732306')) $hash_algo = 'sha512/256'; |
if (uuid_equal($hash_algo, '9768761f-ac5a-419e-a180-7ca239e8025a')) $hash_algo = 'sha3-224'; |
if (uuid_equal($hash_algo, '2034d66b-4047-4553-8f80-70e593176877')) $hash_algo = 'sha3-256'; |
if (uuid_equal($hash_algo, '872fb339-2636-4bdd-bda6-b6dc2a82b1b3')) $hash_algo = 'sha3-384'; |
if (uuid_equal($hash_algo, 'a4920a5d-a8a6-426c-8d14-a6cafbe64c7b')) $hash_algo = 'sha3-512'; |
if (uuid_equal($hash_algo, '7ea218f6-629a-425f-9f88-7439d63296bb')) $hash_algo = 'shake128'; |
if (uuid_equal($hash_algo, '2e7fc6a4-2919-4edc-b0ba-7d7062ce4f0a')) $hash_algo = 'shake256'; |
} |
$hash_algo = $algo; |
break; |
} |
} |
} |
if ($hash_algo == 'shake128') $hash = shake128($payload, 16/*min. required bytes*/, false); |
else if ($hash_algo == 'shake256') $hash = shake256($payload, 16/*min. required bytes*/, false); |
1359,31 → 1362,6 |
substr($hash, 20, 12); |
} |
/** |
* Collection of Namebased UUIDv8 Hash Space IDs |
* @return array An array containing tuples of [PHP Algo Name, Hash Space UUID, Human friendly name, Hash Space Author, Available] |
*/ |
function get_uuidv8_hash_space_ids(): array { |
$out = array(); |
// The following Hash Space UUIDs are defined in draft-ietf-uuidrev-rfc4122bis-11 as Example for Namebased UUIDv8 |
$category = 'Internet Draft 11, Appendix B'; |
$out[] = ['sha224', '59031ca3-fbdb-47fb-9f6c-0f30e2e83145', 'SHA-224', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha256', '3fb32780-953c-4464-9cfd-e85dbbe9843d', 'SHA-256', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha384', 'e6800581-f333-484b-8778-601ff2b58da8', 'SHA-384', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha512', '0fde22f2-e7ba-4fd1-9753-9c2ea88fa3f9', 'SHA-512', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha512/224', '003c2038-c4fe-4b95-a672-0c26c1b79542', 'SHA-512/224', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha512/256', '9475ad00-3769-4c07-9642-5e7383732306', 'SHA-512/256', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha3-224', '9768761f-ac5a-419e-a180-7ca239e8025a', 'SHA3-224', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha3-256', '2034d66b-4047-4553-8f80-70e593176877', 'SHA3-256', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha3-384', '872fb339-2636-4bdd-bda6-b6dc2a82b1b3', 'SHA3-384', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['sha3-512', 'a4920a5d-a8a6-426c-8d14-a6cafbe64c7b', 'SHA3-512', $category, PHP_VERSION_ID >= 70100]; |
$out[] = ['shake128'/*Currently no PHP core algorithm!*/, '7ea218f6-629a-425f-9f88-7439d63296bb', 'SHAKE128', $category, file_exists(__DIR__.'/SHA3.php')]; |
$out[] = ['shake256'/*Currently no PHP core algorithm!*/, '2e7fc6a4-2919-4edc-b0ba-7d7062ce4f0a', 'SHAKE256', $category, file_exists(__DIR__.'/SHA3.php')]; |
return $out; |
} |
# -------------------------------------- |
// http://php.net/manual/de/function.hex2bin.php#113057 |
/trunk/vendor/emn178/js-sha3/CHANGELOG.md |
---|
1,9 → 1,5 |
# Change Log |
## v0.9.1 / 2023-08-31 |
### Fixed |
- cSHAKE empty Array bug. #24 |
## v0.9.0 / 2023-08-30 |
### Fixed |
- cSHAKE bug. #24 |
/trunk/vendor/emn178/js-sha3/bower.json |
---|
1,6 → 1,6 |
{ |
"name": "js-sha3", |
"version": "0.9.1", |
"version": "0.9.0", |
"main": ["src/sha3.js"], |
"ignore": [ |
"samples", |
/trunk/vendor/emn178/js-sha3/build/sha3.min.js |
---|
1,9 → 1,9 |
/** |
* [js-sha3]{@link https://github.com/emn178/js-sha3} |
* |
* @version 0.9.1 |
* @version 0.9.0 |
* @author Chen, Yi-Cyuan [emn178@gmail.com] |
* @copyright Chen, Yi-Cyuan 2015-2023 |
* @license MIT |
*/ |
!function(){"use strict";function t(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function e(e,r,n){t.call(this,e,r,n)}var r="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?i=global:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&"object"==typeof module&&module.exports,s="function"==typeof define&&define.amd,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),c=[4,1024,262144,67108864],h=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],l=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],b={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var v=function(t){var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(r);if(null===t)throw new Error(r);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(r);e=!0}return[t,e]},A=function(t){return 0===v(t)[0].length},g=function(e,r,n){return function(i){return new t(e,r,e).update(i)[n]()}},B=function(e,r,n){return function(i,o){return new t(e,r,o).update(i)[n]()}},w=function(t,e,r){return function(e,n,i,o){return x["cshake"+t].update(e,n,i,o)[r]()}},_=function(t,e,r){return function(e,n,i,o){return x["kmac"+t].update(e,n,i,o)[r]()}},k=function(t,e,r,n){for(var i=0;i<y.length;++i){var o=y[i];t[o]=e(r,n,o)}return t},S=function(e,r){var n=g(e,r,"hex");return n.create=function(){return new t(e,r,e)},n.update=function(t){return n.create().update(t)},k(n,g,e,r)},C=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:S},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:S},{name:"shake",padding:[31,7936,2031616,520093696],bits:l,createMethod:function(e,r){var n=B(e,r,"hex");return n.create=function(n){return new t(e,r,n)},n.update=function(t,e){return n.create(e).update(t)},k(n,B,e,r)}},{name:"cshake",padding:c,bits:l,createMethod:function(e,r){var n=b[e],i=w(e,0,"hex");return i.create=function(i,o,a){return A(o)&&A(a)?x["shake"+e].create(i):new t(e,r,i).bytepad([o,a],n)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},k(i,w,e,r)}},{name:"kmac",padding:c,bits:l,createMethod:function(t,r){var n=b[t],i=_(t,0,"hex");return i.create=function(i,o,a){return new e(t,r,o).bytepad(["KMAC",a],n).bytepad([i],n)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},k(i,_,t,r)}}],x={},m=[],O=0;O<C.length;++O)for(var z=C[O],N=z.bits,E=0;E<N.length;++E){var J=z.name+"_"+N[E];if(m.push(J),x[J]=z.createMethod(N[E],z.padding),"sha3"!==z.name){var M=z.name+N[E];m.push(M),x[M]=x[J]}}t.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e=v(t);t=e[0];for(var r,n,i=e[1],o=this.blocks,a=this.byteCount,s=t.length,u=this.blockCount,f=0,c=this.s;f<s;){if(this.reset)for(this.reset=!1,o[0]=this.block,r=1;r<u+1;++r)o[r]=0;if(i)for(r=this.start;f<s&&r<a;++f)o[r>>2]|=t[f]<<h[3&r++];else for(r=this.start;f<s&&r<a;++f)(n=t.charCodeAt(f))<128?o[r>>2]|=n<<h[3&r++]:n<2048?(o[r>>2]|=(192|n>>6)<<h[3&r++],o[r>>2]|=(128|63&n)<<h[3&r++]):n<55296||n>=57344?(o[r>>2]|=(224|n>>12)<<h[3&r++],o[r>>2]|=(128|n>>6&63)<<h[3&r++],o[r>>2]|=(128|63&n)<<h[3&r++]):(n=65536+((1023&n)<<10|1023&t.charCodeAt(++f)),o[r>>2]|=(240|n>>18)<<h[3&r++],o[r>>2]|=(128|n>>12&63)<<h[3&r++],o[r>>2]|=(128|n>>6&63)<<h[3&r++],o[r>>2]|=(128|63&n)<<h[3&r++]);if(this.lastByteIndex=r,r>=a){for(this.start=r-a,this.block=o[u],r=0;r<u;++r)c[r]^=o[r];j(c),this.reset=!0}else this.start=r}return this},t.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},t.prototype.encodeString=function(t){var e=v(t);t=e[0];var r=e[1],n=0,i=t.length;if(r)n=i;else for(var o=0;o<t.length;++o){var a=t.charCodeAt(o);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(t),n},t.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=(e-r%e)%e,o=[];return o.length=i,this.update(o),this},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];j(n)}},t.prototype.toString=t.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<n;){for(o=0;o<e&&a<n;++o,++a)t=r[o],s+=f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15];a%e==0&&(j(r),o=0)}return i&&(t=r[o],s+=f[t>>4&15]+f[15&t],i>1&&(s+=f[t>>12&15]+f[t>>8&15]),i>2&&(s+=f[t>>20&15]+f[t>>16&15])),s},t.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<n;){for(o=0;o<e&&a<n;++o,++a)u[a]=r[o];a%e==0&&j(r)}return i&&(u[o]=r[o],t=t.slice(0,s)),t},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.digest=t.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<r&&s<i;++a,++s)t=s<<2,e=n[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r==0&&j(n)}return o&&(t=s<<2,e=n[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},(e.prototype=new t).finalize=function(){return this.encode(this.outputBits,!0),t.prototype.finalize.call(this)};var j=function(t){var e,r,n,i,o,a,s,u,f,c,h,d,l,y,b,v,A,g,B,w,_,k,S,C,x,m,O,z,N,E,J,M,j,H,I,R,F,U,V,D,W,Y,K,q,G,L,P,Q,T,X,Z,$,tt,et,rt,nt,it,ot,at,st,ut,ft,ct;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),r=(l=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|f>>>31),r=o^(f<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(c<<1|h>>>31),r=s^(h<<1|c>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(d<<1|l>>>31),r=f^(l<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=c^(i<<1|o>>>31),r=h^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,y=t[0],b=t[1],L=t[11]<<4|t[10]>>>28,P=t[10]<<4|t[11]>>>28,z=t[20]<<3|t[21]>>>29,N=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,H=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,v=t[13]<<12|t[12]>>>20,A=t[12]<<12|t[13]>>>20,Q=t[22]<<10|t[23]>>>22,T=t[23]<<10|t[22]>>>22,E=t[33]<<13|t[32]>>>19,J=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ct=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,R=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,B=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,M=t[45]<<29|t[44]>>>3,j=t[44]<<29|t[45]>>>3,C=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,V=t[27]<<25|t[26]>>>7,w=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,q=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,m=t[18]<<20|t[19]>>>12,O=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,D=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,k=t[48]<<14|t[49]>>>18,S=t[49]<<14|t[48]>>>18,t[0]=y^~v&g,t[1]=b^~A&B,t[10]=C^~m&z,t[11]=x^~O&N,t[20]=H^~R&U,t[21]=I^~F&V,t[30]=q^~L&Q,t[31]=G^~P&T,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=v^~g&w,t[3]=A^~B&_,t[12]=m^~z&E,t[13]=O^~N&J,t[22]=R^~U&D,t[23]=F^~V&W,t[32]=L^~Q&X,t[33]=P^~T&Z,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=g^~w&k,t[5]=B^~_&S,t[14]=z^~E&M,t[15]=N^~J&j,t[24]=U^~D&Y,t[25]=V^~W&K,t[34]=Q^~X&$,t[35]=T^~Z&tt,t[44]=ot^~st&ft,t[45]=at^~ut&ct,t[6]=w^~k&y,t[7]=_^~S&b,t[16]=E^~M&C,t[17]=J^~j&x,t[26]=D^~Y&H,t[27]=W^~K&I,t[36]=X^~$&q,t[37]=Z^~tt&G,t[46]=st^~ft&et,t[47]=ut^~ct&rt,t[8]=k^~y&v,t[9]=S^~b&A,t[18]=M^~C&m,t[19]=j^~x&O,t[28]=Y^~H&R,t[29]=K^~I&F,t[38]=$^~q&L,t[39]=tt^~G&P,t[48]=ft^~et&nt,t[49]=ct^~rt&it,t[0]^=p[n],t[1]^=p[n+1]};if(a)module.exports=x;else{for(O=0;O<m.length;++O)i[m[O]]=x[m[O]];s&&define(function(){return x})}}(); |
!function(){"use strict";function t(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function e(e,r,n){t.call(this,e,r,n)}var r="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?i=global:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&"object"==typeof module&&module.exports,s="function"==typeof define&&define.amd,u=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),c=[4,1024,262144,67108864],h=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],l=[128,256],y=["hex","buffer","arrayBuffer","array","digest"],b={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var A=function(e,r,n){return function(i){return new t(e,r,e).update(i)[n]()}},w=function(e,r,n){return function(i,o){return new t(e,r,o).update(i)[n]()}},v=function(t,e,r){return function(e,n,i,o){return S["cshake"+t].update(e,n,i,o)[r]()}},B=function(t,e,r){return function(e,n,i,o){return S["kmac"+t].update(e,n,i,o)[r]()}},g=function(t,e,r,n){for(var i=0;i<y.length;++i){var o=y[i];t[o]=e(r,n,o)}return t},_=function(e,r){var n=A(e,r,"hex");return n.create=function(){return new t(e,r,e)},n.update=function(t){return n.create().update(t)},g(n,A,e,r)},k=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:_},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:_},{name:"shake",padding:[31,7936,2031616,520093696],bits:l,createMethod:function(e,r){var n=w(e,r,"hex");return n.create=function(n){return new t(e,r,n)},n.update=function(t,e){return n.create(e).update(t)},g(n,w,e,r)}},{name:"cshake",padding:c,bits:l,createMethod:function(e,r){var n=b[e],i=v(e,0,"hex");return i.create=function(i,o,a){return o||a?new t(e,r,i).bytepad([o,a],n):S["shake"+e].create(i)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},g(i,v,e,r)}},{name:"kmac",padding:c,bits:l,createMethod:function(t,r){var n=b[t],i=B(t,0,"hex");return i.create=function(i,o,a){return new e(t,r,o).bytepad(["KMAC",a],n).bytepad([i],n)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},g(i,B,t,r)}}],S={},C=[],x=0;x<k.length;++x)for(var m=k[x],E=m.bits,O=0;O<E.length;++O){var z=m.name+"_"+E[O];if(C.push(z),S[z]=m.createMethod(E[O],m.padding),"sha3"!==m.name){var N=m.name+E[O];C.push(N),S[N]=S[z]}}t.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(r);if(null===t)throw new Error(r);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(r);e=!0}for(var i,o,a=this.blocks,s=this.byteCount,f=t.length,c=this.blockCount,p=0,d=this.s;p<f;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<c+1;++i)a[i]=0;if(e)for(i=this.start;p<f&&i<s;++p)a[i>>2]|=t[p]<<h[3&i++];else for(i=this.start;p<f&&i<s;++p)(o=t.charCodeAt(p))<128?a[i>>2]|=o<<h[3&i++]:o<2048?(a[i>>2]|=(192|o>>6)<<h[3&i++],a[i>>2]|=(128|63&o)<<h[3&i++]):o<55296||o>=57344?(a[i>>2]|=(224|o>>12)<<h[3&i++],a[i>>2]|=(128|o>>6&63)<<h[3&i++],a[i>>2]|=(128|63&o)<<h[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++p)),a[i>>2]|=(240|o>>18)<<h[3&i++],a[i>>2]|=(128|o>>12&63)<<h[3&i++],a[i>>2]|=(128|o>>6&63)<<h[3&i++],a[i>>2]|=(128|63&o)<<h[3&i++]);if(this.lastByteIndex=i,i>=s){for(this.start=i-s,this.block=a[c],i=0;i<c;++i)d[i]^=a[i];j(d),this.reset=!0}else this.start=i}return this},t.prototype.encode=function(t,e){var r=255&t,n=1,i=[r];for(r=255&(t>>=8);r>0;)i.unshift(r),r=255&(t>>=8),++n;return e?i.push(n):i.unshift(n),this.update(i),i.length},t.prototype.encodeString=function(t){var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(r);if(null===t)throw new Error(r);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(r);e=!0}var i=0,o=t.length;if(e)i=o;else for(var a=0;a<t.length;++a){var s=t.charCodeAt(a);s<128?i+=1:s<2048?i+=2:s<55296||s>=57344?i+=3:(s=65536+((1023&s)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},t.prototype.bytepad=function(t,e){for(var r=this.encode(e),n=0;n<t.length;++n)r+=this.encodeString(t[n]);var i=(e-r%e)%e,o=[];return o.length=i,this.update(o),this},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,n=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)n[e]^=t[e];j(n)}},t.prototype.toString=t.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<n;){for(o=0;o<e&&a<n;++o,++a)t=r[o],s+=f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15];a%e==0&&(j(r),o=0)}return i&&(t=r[o],s+=f[t>>4&15]+f[15&t],i>1&&(s+=f[t>>12&15]+f[t>>8&15]),i>2&&(s+=f[t>>20&15]+f[t>>16&15])),s},t.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<n;){for(o=0;o<e&&a<n;++o,++a)u[a]=r[o];a%e==0&&j(r)}return i&&(u[o]=r[o],t=t.slice(0,s)),t},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.digest=t.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<r&&s<i;++a,++s)t=s<<2,e=n[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%r==0&&j(n)}return o&&(t=s<<2,e=n[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},(e.prototype=new t).finalize=function(){return this.encode(this.outputBits,!0),t.prototype.finalize.call(this)};var j=function(t){var e,r,n,i,o,a,s,u,f,c,h,d,l,y,b,A,w,v,B,g,_,k,S,C,x,m,E,O,z,N,j,J,M,H,I,R,U,V,F,D,W,Y,K,q,G,L,P,Q,T,X,Z,$,tt,et,rt,nt,it,ot,at,st,ut,ft,ct;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),r=(l=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(u<<1|f>>>31),r=o^(f<<1|u>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=a^(c<<1|h>>>31),r=s^(h<<1|c>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=u^(d<<1|l>>>31),r=f^(l<<1|d>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=c^(i<<1|o>>>31),r=h^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,y=t[0],b=t[1],L=t[11]<<4|t[10]>>>28,P=t[10]<<4|t[11]>>>28,O=t[20]<<3|t[21]>>>29,z=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,H=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,A=t[13]<<12|t[12]>>>20,w=t[12]<<12|t[13]>>>20,Q=t[22]<<10|t[23]>>>22,T=t[23]<<10|t[22]>>>22,N=t[33]<<13|t[32]>>>19,j=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ct=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,R=t[14]<<6|t[15]>>>26,U=t[15]<<6|t[14]>>>26,v=t[25]<<11|t[24]>>>21,B=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,J=t[45]<<29|t[44]>>>3,M=t[44]<<29|t[45]>>>3,C=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,V=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,g=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,q=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,m=t[18]<<20|t[19]>>>12,E=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,D=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,k=t[48]<<14|t[49]>>>18,S=t[49]<<14|t[48]>>>18,t[0]=y^~A&v,t[1]=b^~w&B,t[10]=C^~m&O,t[11]=x^~E&z,t[20]=H^~R&V,t[21]=I^~U&F,t[30]=q^~L&Q,t[31]=G^~P&T,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=A^~v&g,t[3]=w^~B&_,t[12]=m^~O&N,t[13]=E^~z&j,t[22]=R^~V&D,t[23]=U^~F&W,t[32]=L^~Q&X,t[33]=P^~T&Z,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=v^~g&k,t[5]=B^~_&S,t[14]=O^~N&J,t[15]=z^~j&M,t[24]=V^~D&Y,t[25]=F^~W&K,t[34]=Q^~X&$,t[35]=T^~Z&tt,t[44]=ot^~st&ft,t[45]=at^~ut&ct,t[6]=g^~k&y,t[7]=_^~S&b,t[16]=N^~J&C,t[17]=j^~M&x,t[26]=D^~Y&H,t[27]=W^~K&I,t[36]=X^~$&q,t[37]=Z^~tt&G,t[46]=st^~ft&et,t[47]=ut^~ct&rt,t[8]=k^~y&A,t[9]=S^~b&w,t[18]=J^~C&m,t[19]=M^~x&E,t[28]=Y^~H&R,t[29]=K^~I&U,t[38]=$^~q&L,t[39]=tt^~G&P,t[48]=ft^~et&nt,t[49]=ct^~rt&it,t[0]^=p[n],t[1]^=p[n+1]};if(a)module.exports=S;else{for(x=0;x<C.length;++x)i[C[x]]=S[C[x]];s&&define(function(){return S})}}(); |
/trunk/vendor/emn178/js-sha3/package-lock.json |
---|
1,6 → 1,6 |
{ |
"name": "js-sha3", |
"version": "0.9.1", |
"version": "0.9.0", |
"lockfileVersion": 1, |
"requires": true, |
"dependencies": { |
/trunk/vendor/emn178/js-sha3/package.json |
---|
1,6 → 1,6 |
{ |
"name": "js-sha3", |
"version": "0.9.1", |
"version": "0.9.0", |
"description": "A simple SHA-3 / Keccak / Shake hash function for JavaScript supports UTF-8 encoding.", |
"main": "src/sha3.js", |
"devDependencies": { |
/trunk/vendor/emn178/js-sha3/src/sha3.js |
---|
1,7 → 1,7 |
/** |
* [js-sha3]{@link https://github.com/emn178/js-sha3} |
* |
* @version 0.9.1 |
* @version 0.9.0 |
* @author Chen, Yi-Cyuan [emn178@gmail.com] |
* @copyright Chen, Yi-Cyuan 2015-2023 |
* @license MIT |
58,31 → 58,6 |
}; |
} |
var formatMessage = function (message) { |
var notString, type = typeof message; |
if (type !== 'string') { |
if (type === 'object') { |
if (message === null) { |
throw new Error(INPUT_ERROR); |
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { |
message = new Uint8Array(message); |
} else if (!Array.isArray(message)) { |
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { |
throw new Error(INPUT_ERROR); |
} |
} |
} else { |
throw new Error(INPUT_ERROR); |
} |
notString = true; |
} |
return [message, notString]; |
} |
var empty = function (message) { |
return formatMessage(message)[0].length === 0; |
}; |
var createOutputMethod = function (bits, padding, outputType) { |
return function (message) { |
return new Keccak(bits, padding, bits).update(message)[outputType](); |
141,7 → 116,7 |
var w = CSHAKE_BYTEPAD[bits]; |
var method = createCshakeOutputMethod(bits, padding, 'hex'); |
method.create = function (outputBits, n, s) { |
if (empty(n) && empty(s)) { |
if (!n && !s) { |
return methods['shake' + bits].create(outputBits); |
} else { |
return new Keccak(bits, padding, outputBits).bytepad([n, s], w); |
213,9 → 188,23 |
if (this.finalized) { |
throw new Error(FINALIZE_ERROR); |
} |
var result = formatMessage(message); |
message = result[0]; |
var notString = result[1]; |
var notString, type = typeof message; |
if (type !== 'string') { |
if (type === 'object') { |
if (message === null) { |
throw new Error(INPUT_ERROR); |
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { |
message = new Uint8Array(message); |
} else if (!Array.isArray(message)) { |
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { |
throw new Error(INPUT_ERROR); |
} |
} |
} else { |
throw new Error(INPUT_ERROR); |
} |
notString = true; |
} |
var blocks = this.blocks, byteCount = this.byteCount, length = message.length, |
blockCount = this.blockCount, index = 0, s = this.s, i, code; |
289,9 → 278,23 |
}; |
Keccak.prototype.encodeString = function (str) { |
var result = formatMessage(str); |
str = result[0]; |
var notString = result[1]; |
var notString, type = typeof str; |
if (type !== 'string') { |
if (type === 'object') { |
if (str === null) { |
throw new Error(INPUT_ERROR); |
} else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { |
str = new Uint8Array(str); |
} else if (!Array.isArray(str)) { |
if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { |
throw new Error(INPUT_ERROR); |
} |
} |
} else { |
throw new Error(INPUT_ERROR); |
} |
notString = true; |
} |
var bytes = 0, length = str.length; |
if (notString) { |
bytes = length; |
/trunk/vendor/licenses |
---|
16,8 → 16,8 |
danielmarschall/php-sha3 dev-master 5605bd5 MIT |
danielmarschall/php_utils 9999999-dev 06a9716 Apache-2.0 |
danielmarschall/php_utils dev-master 06a9716 Apache-2.0 |
danielmarschall/uuid_mac_utils 9999999-dev ba81df1 Apache-2.0 |
danielmarschall/uuid_mac_utils dev-master ba81df1 Apache-2.0 |
danielmarschall/uuid_mac_utils 9999999-dev 4a4fbab Apache-2.0 |
danielmarschall/uuid_mac_utils dev-master 4a4fbab Apache-2.0 |
danielmarschall/vnag 9999999-dev 672c22e Apache-2.0 |
danielmarschall/vnag dev-master 672c22e Apache-2.0 |
dcodeio/bcrypt.js master master BSD-3-Clause, MIT |
28,9 → 28,11 |
matthiasmullie/path-converter 1.1.3 MIT |
paragonie/constant_time_encoding v2.6.3 MIT |
paragonie/random_compat v9.99.100 MIT |
phpseclib/phpseclib 3.0.x-dev c5b4d08 MIT |
phpseclib/phpseclib 3.0.x-dev 967210f MIT |
script47/bs5-utils master master MIT |
spamspan/spamspan master GPL-2.0-only |
spomky-labs/php-punycode 9999999-dev d12fe5c MIT |
spomky-labs/php-punycode dev-master d12fe5c MIT |
symfony/polyfill-mbstring v1.19.0 MIT |
tinymce/tinymce 5.x-dev f078d8e LGPL-2.1-only |
twbs/bootstrap v5.3.2 MIT |
/trunk/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php |
---|
668,11 → 668,11 |
switch (true) { |
// PHP_OS & "\xDF\xDF\xDF" == strtoupper(substr(PHP_OS, 0, 3)), but a lot faster |
case (PHP_OS & "\xDF\xDF\xDF") === 'WIN': |
case (php_uname('m') & "\xDF\xDF\xDF") != 'ARM': |
case !(is_string(php_uname('m')) && (php_uname('m') & "\xDF\xDF\xDF") == 'ARM'): |
case defined('PHP_INT_SIZE') && PHP_INT_SIZE == 8: |
self::$use_reg_intval = true; |
break; |
case (php_uname('m') & "\xDF\xDF\xDF") == 'ARM': |
case is_string(php_uname('m')) && (php_uname('m') & "\xDF\xDF\xDF") == 'ARM': |
switch (true) { |
/* PHP 7.0.0 introduced a bug that affected 32-bit ARM processors: |
/trunk/vendor/spomky-labs/php-punycode/.scrutinizer.yml |
---|
0,0 → 1,21 |
before_commands: |
- "composer install --no-interaction" |
checks: |
php: |
code_rating: true |
duplication: true |
tools: |
php_sim: true |
php_changetracking: true |
php_cpd: true |
php_mess_detector: true |
php_code_sniffer: true |
php_analyzer: true |
sensiolabs_security_checker: true |
php_code_coverage: false |
php_pdepend: |
excluded_dirs: [vendor, doc, tests] |
filter: |
excluded_paths: [vendor/*, doc/*, tests/*] |
/trunk/vendor/spomky-labs/php-punycode/.travis.yml |
---|
0,0 → 1,19 |
language: php |
php: |
- 5.4 |
- 5.5 |
- 5.6 |
- 7.0 |
- hhvm |
- nightly |
before_script: |
- composer install |
- mkdir -p build/logs |
script: |
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml |
after_success: |
- vendor/bin/coveralls --no-interaction |
/trunk/vendor/spomky-labs/php-punycode/LICENSE |
---|
0,0 → 1,23 |
The MIT License |
Copyright (c) 2015 Florent Morselli |
Original code from TrueServer B.V. |
Permission is hereby granted, free of charge, to any person obtaining a copy |
of this software and associated documentation files (the "Software"), to deal |
in the Software without restriction, including without limitation the rights |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
copies of the Software, and to permit persons to whom the Software is |
furnished to do so, subject to the following conditions: |
The above copyright notice and this permission notice shall be included in |
all copies or substantial portions of the Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
THE SOFTWARE. |
/trunk/vendor/spomky-labs/php-punycode/README.md |
---|
0,0 → 1,60 |
Punycode |
======== |
[![Build Status](https://travis-ci.org/Spomky-Labs/php-punycode.svg)](https://travis-ci.org/Spomky-Labs/php-punycode) |
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Spomky-Labs/php-punycode/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Spomky-Labs/php-punycode/?branch=master) |
[![Coverage Status](https://coveralls.io/repos/Spomky-Labs/php-punycode/badge.svg?branch=master&service=github)](https://coveralls.io/github/Spomky-Labs/php-punycode?branch=master) |
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d59a9463-ed65-4304-a764-04f62d3fd58c/big.png)](https://insight.sensiolabs.com/projects/d59a9463-ed65-4304-a764-04f62d3fd58c) |
[![Latest Stable Version](https://poser.pugx.org/spomky-labs/php-punycode/v/stable.png)](https://packagist.org/packages/spomky-labs/php-punycode) |
[![Total Downloads](https://poser.pugx.org/spomky-labs/php-punycode/downloads.png)](https://packagist.org/packages/spomky-labs/php-punycode) |
[![Latest Unstable Version](https://poser.pugx.org/spomky-labs/php-punycode/v/unstable.png)](https://packagist.org/packages/spomky-labs/php-punycode) |
[![License](https://poser.pugx.org/spomky-labs/php-punycode/license.png)](https://packagist.org/packages/spomky-labs/php-punycode) |
A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA). |
Original code from https://github.com/true/php-punycode |
# The Release Process |
The release process [is described here](doc/Release.md). |
# Prerequisites |
This library needs at least ![PHP 5.4+](https://img.shields.io/badge/PHP-5.4%2B-ff69b4.svg). |
It has been successfully tested using `PHP 5.4` to `PHP 5.6`, `PHP 7` (`7.0` and nightly) and `HHVM`. |
# Installation |
The preferred way to install this library is to rely on Composer: |
```sh |
composer require "spomky-labs/php-punycode" |
``` |
# How to use |
```php |
<?php |
// Import Punycode |
use SpomkyLabs\Punycode; |
var_dump(Punycode::encode('renangonçalves.com')); |
// outputs: xn--renangonalves-pgb.com |
var_dump(Punycode::decode('xn--renangonalves-pgb.com')); |
// outputs: renangonçalves.com |
``` |
# Contributing |
Requests for new features, bug fixed and all other ideas to make this library useful are welcome. [Please follow these best practices](doc/Contributing.md). |
# Licence |
This library is release under [MIT licence](LICENSE.txt). |
/trunk/vendor/spomky-labs/php-punycode/composer.json |
---|
0,0 → 1,33 |
{ |
"name": "spomky-labs/php-punycode", |
"description": "A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)", |
"keywords": ["IDNA", "punycode"], |
"homepage": "https://github.com/spomky-labs/php-punycode", |
"license": "MIT", |
"authors": [ |
{ |
"name": "Renan Gonçalves", |
"email": "renan.saddam@gmail.com" |
}, |
{ |
"name": "Florent Morselli" |
}, |
{ |
"name": "All contributors", |
"homepage": "https://github.com/Spomky-Labs/oauth2-server-library/contributors" |
} |
], |
"autoload": { |
"psr-4": { |
"SpomkyLabs\\": "src/" |
} |
}, |
"require": { |
"php": ">=5.4", |
"symfony/polyfill-mbstring": "^1.1" |
}, |
"require-dev": { |
"phpunit/phpunit": "^4.8|^5.0", |
"satooshi/php-coveralls": "^1.0" |
} |
} |
/trunk/vendor/spomky-labs/php-punycode/doc/Contributing.md |
---|
0,0 → 1,26 |
Contributing |
============ |
First of all, **thank you** for contributing. |
Bugs or feature requests can be posted online on the GitHub issues section of the project. |
Few rules to ease code reviews and merges: |
- You MUST follow the [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/) and [PSR-4](http://www.php-fig.org/psr/psr-4/) coding standards. |
- You MUST run the test suite. |
- You MUST write (or update) unit tests when bugs are fixed or features are added. |
- You SHOULD write documentation. |
We use [Git-Flow](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/) to automate our git branching workflow. |
To contribute use [Pull Requests](https://help.github.com/articles/using-pull-requests), please, write commit messages that make sense, and rebase your branch before submitting your PR. |
May be asked to squash your commits too. This is used to "clean" your Pull Request before merging it, avoiding commits such as fix tests, fix 2, fix 3, etc. |
Run test suite |
------------ |
* install composer: `curl -s http://getcomposer.org/installer | php` |
* install dependencies: `php composer.phar install` |
* run tests: `vendor/bin/phpunit` |
/trunk/vendor/spomky-labs/php-punycode/doc/Release.md |
---|
0,0 → 1,19 |
The Release Process |
=================== |
We manage its releases through features and time-based models. |
- A new patch version comes out every month when you made backwards-compatible bug fixes. |
- A new minor version comes every six months when we added functionality in a backwards-compatible manner. |
- A new major version comes every year when we make incompatible API changes. |
The meaning of "patch" "minor" and "major" comes from the Semantic [Versioning strategy](http://semver.org/). |
This release process applies from version 3.0.x. |
Backwards Compatibility |
----------------------- |
We allow developers to upgrade with confidence from one minor version to the next one. |
Whenever keeping backward compatibility is not possible, the feature, the enhancement or the bug fix will be scheduled for the next major version. |
/trunk/vendor/spomky-labs/php-punycode/phpunit.xml.dist |
---|
0,0 → 1,29 |
<?xml version="1.0" encoding="UTF-8"?> |
<phpunit |
backupGlobals="false" |
backupStaticAttributes="false" |
convertErrorsToExceptions="true" |
convertNoticesToExceptions="true" |
convertWarningsToExceptions="true" |
processIsolation="false" |
stopOnFailure="false" |
syntaxCheck="false" |
bootstrap="vendor/autoload.php" |
colors="true"> |
<testsuites> |
<testsuite name="Test Suite"> |
<directory suffix="Test.php">./tests</directory> |
</testsuite> |
</testsuites> |
<filter> |
<whitelist> |
<directory suffix=".php">./</directory> |
<exclude> |
<directory>./tests</directory> |
<directory>./doc</directory> |
<directory>./vendor</directory> |
</exclude> |
</whitelist> |
</filter> |
</phpunit> |
/trunk/vendor/spomky-labs/php-punycode/src/Punycode.php |
---|
0,0 → 1,330 |
<?php |
namespace SpomkyLabs; |
/** |
* Punycode implementation as described in RFC 3492. |
* |
* @link http://tools.ietf.org/html/rfc3492 |
*/ |
final class Punycode |
{ |
/** |
* Bootstring parameter values. |
*/ |
const BASE = 36; |
const TMIN = 1; |
const TMAX = 26; |
const SKEW = 38; |
const DAMP = 700; |
const INITIAL_BIAS = 72; |
const INITIAL_N = 128; |
const PREFIX = 'xn--'; |
const DELIMITER = '-'; |
/** |
* Encode table. |
* |
* @param array |
*/ |
private static $encodeTable = [ |
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', |
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', |
'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', |
]; |
/** |
* Decode table. |
* |
* @param array |
*/ |
private static $decodeTable = [ |
'a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5, |
'g' => 6, 'h' => 7, 'i' => 8, 'j' => 9, 'k' => 10, 'l' => 11, |
'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17, |
's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23, |
'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29, |
'4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35, |
]; |
/** |
* Encode a domain to its Punycode version. |
* |
* @param string $input Domain name in Unicode to be encoded |
* @param string $encoding Character encoding |
* |
* @return string Punycode representation in ASCII |
*/ |
public static function encode($input, $encoding = 'UTF-8') |
{ |
$input = mb_strtolower($input, $encoding); |
$parts = explode('.', $input); |
foreach ($parts as &$part) { |
$part = self::encodePart($part, $encoding); |
} |
return implode('.', $parts); |
} |
/** |
* Encode a part of a domain name, such as tld, to its Punycode version. |
* |
* @param string $input Part of a domain name |
* @param string $encoding Character encoding |
* |
* @return string Punycode representation of a domain part |
*/ |
private static function encodePart($input, $encoding) |
{ |
$codePoints = self::listCodePoints($input, $encoding); |
$n = static::INITIAL_N; |
$bias = static::INITIAL_BIAS; |
$delta = 0; |
$h = $b = count($codePoints['basic']); |
$output = ''; |
foreach ($codePoints['basic'] as $code) { |
$output .= self::codePointToChar($code); |
} |
if ($input === $output) { |
return $output; |
} |
if ($b > 0) { |
$output .= static::DELIMITER; |
} |
$codePoints['nonBasic'] = array_unique($codePoints['nonBasic']); |
sort($codePoints['nonBasic']); |
$i = 0; |
$length = mb_strlen($input, $encoding); |
while ($h < $length) { |
$m = $codePoints['nonBasic'][$i++]; |
$delta = $delta + ($m - $n) * ($h + 1); |
$n = $m; |
foreach ($codePoints['all'] as $c) { |
if ($c < $n || $c < static::INITIAL_N) { |
++$delta; |
} |
if ($c === $n) { |
$q = $delta; |
for ($k = static::BASE; ; $k += static::BASE) { |
$t = self::calculateThreshold($k, $bias); |
if ($q < $t) { |
break; |
} |
$code = $t + (($q - $t) % (static::BASE - $t)); |
$output .= static::$encodeTable[$code]; |
$q = ($q - $t) / (static::BASE - $t); |
} |
$output .= static::$encodeTable[$q]; |
$bias = self::adapt($delta, $h + 1, ($h === $b)); |
$delta = 0; |
++$h; |
} |
} |
++$delta; |
++$n; |
} |
return static::PREFIX.$output; |
} |
/** |
* Decode a Punycode domain name to its Unicode counterpart. |
* |
* @param string $input Domain name in Punycode |
* @param string $encoding Character encoding |
* |
* @return string Unicode domain name |
*/ |
public static function decode($input, $encoding = 'UTF-8') |
{ |
$parts = explode('.', $input); |
foreach ($parts as &$part) { |
if (strpos($part, static::PREFIX) !== 0) { |
continue; |
} |
$part = mb_substr($part, mb_strlen(static::PREFIX, $encoding), null, $encoding); |
$part = self::decodePart($part, $encoding); |
} |
return implode('.', $parts); |
} |
/** |
* Decode a part of domain name, such as tld. |
* |
* @param string $input Part of a domain name |
* @param string $encoding Character encoding |
* |
* @return string Unicode domain part |
*/ |
private static function decodePart($input, $encoding) |
{ |
$n = static::INITIAL_N; |
$i = 0; |
$bias = static::INITIAL_BIAS; |
$output = ''; |
$pos = mb_strrpos($input, static::DELIMITER, null, $encoding); |
if ($pos !== false) { |
$output = mb_substr($input, 0, $pos++, $encoding); |
} else { |
$pos = 0; |
} |
$outputLength = mb_strlen($output, $encoding); |
$inputLength = mb_strlen($input, $encoding); |
while ($pos < $inputLength) { |
$oldi = $i; |
$w = 1; |
for ($k = static::BASE; ; $k += static::BASE) { |
$digit = static::$decodeTable[$input[$pos++]]; |
$i = $i + ($digit * $w); |
$t = self::calculateThreshold($k, $bias); |
if ($digit < $t) { |
break; |
} |
$w = $w * (static::BASE - $t); |
} |
$bias = self::adapt($i - $oldi, ++$outputLength, ($oldi === 0)); |
$n = $n + (int) ($i / $outputLength); |
$i = $i % ($outputLength); |
$output = mb_substr($output, 0, $i, $encoding).self::codePointToChar($n).mb_substr($output, $i, $outputLength - 1, $encoding); |
++$i; |
} |
return $output; |
} |
/** |
* Calculate the bias threshold to fall between TMIN and TMAX. |
* |
* @param int $k |
* @param int $bias |
* |
* @return int |
*/ |
private static function calculateThreshold($k, $bias) |
{ |
if ($k <= $bias + static::TMIN) { |
return static::TMIN; |
} elseif ($k >= $bias + static::TMAX) { |
return static::TMAX; |
} |
return $k - $bias; |
} |
/** |
* Bias adaptation. |
* |
* @param int $delta |
* @param int $numPoints |
* @param bool $firstTime |
* |
* @return int |
*/ |
private static function adapt($delta, $numPoints, $firstTime) |
{ |
$delta = (int) ( |
($firstTime) |
? $delta / static::DAMP |
: $delta / 2 |
); |
$delta += (int) ($delta / $numPoints); |
$k = 0; |
while ($delta > ((static::BASE - static::TMIN) * static::TMAX) / 2) { |
$delta = (int) ($delta / (static::BASE - static::TMIN)); |
$k = $k + static::BASE; |
} |
$k = $k + (int) (((static::BASE - static::TMIN + 1) * $delta) / ($delta + static::SKEW)); |
return $k; |
} |
/** |
* List code points for a given input. |
* |
* @param string $input |
* @param string $encoding |
* |
* @return array Multi-dimension array with basic, non-basic and aggregated code points |
*/ |
private static function listCodePoints($input, $encoding) |
{ |
$codePoints = [ |
'all' => [], |
'basic' => [], |
'nonBasic' => [], |
]; |
$length = mb_strlen($input, $encoding); |
for ($i = 0; $i < $length; ++$i) { |
$char = mb_substr($input, $i, 1, $encoding); |
$code = self::charToCodePoint($char); |
if ($code < 128) { |
$codePoints['all'][] = $codePoints['basic'][] = $code; |
} else { |
$codePoints['all'][] = $codePoints['nonBasic'][] = $code; |
} |
} |
return $codePoints; |
} |
/** |
* Convert a single or multi-byte character to its code point. |
* |
* @param string $char |
* |
* @return int |
*/ |
private static function charToCodePoint($char) |
{ |
$code = ord($char[0]); |
if ($code < 128) { |
return $code; |
} elseif ($code < 224) { |
return (($code - 192) * 64) + (ord($char[1]) - 128); |
} elseif ($code < 240) { |
return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128); |
} else { |
return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128); |
} |
} |
/** |
* Convert a code point to its single or multi-byte character. |
* |
* @param int $code |
* |
* @return string |
*/ |
private static function codePointToChar($code) |
{ |
if ($code <= 0x7F) { |
return chr($code); |
} elseif ($code <= 0x7FF) { |
return chr(($code >> 6) + 192).chr(($code & 63) + 128); |
} elseif ($code <= 0xFFFF) { |
return chr(($code >> 12) + 224).chr((($code >> 6) & 63) + 128).chr(($code & 63) + 128); |
} else { |
return chr(($code >> 18) + 240).chr((($code >> 12) & 63) + 128).chr((($code >> 6) & 63) + 128).chr(($code & 63) + 128); |
} |
} |
} |