diff --git a/.gitignore b/.gitignore index 3d55b0d..ea2f8fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /vendor/ +composer.phar -tests/_output/* \ No newline at end of file +tests/_output/* + +.idea diff --git a/.travis.yml b/.travis.yml index d2389bc..fc84448 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,14 @@ language: php +dist: trusty +sudo: false + php: - 5.4 - 5.5 - 5.6 + - 7.0 + - 7.1 - hhvm before_script: diff --git a/composer.json b/composer.json index 962ec9f..4d13fd1 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ ], "require": { "php": ">=5.4.0", - "ircmaxell/random-lib": "~1.1" + "paragonie/sodium_compat": "^0.7.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 6c2a417..8c3bd04 100644 --- a/composer.lock +++ b/composer.lock @@ -1,43 +1,39 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "053b4adbf557c58c86f080888c56d2dd", + "content-hash": "6e8016823cf0fb1f8f424e393cfdf060", "packages": [ { - "name": "ircmaxell/random-lib", - "version": "v1.1.0", + "name": "paragonie/random_compat", + "version": "v2.0.10", "source": { "type": "git", - "url": "https://github.com/ircmaxell/RandomLib.git", - "reference": "13efa4368bb2ac88bb3b1459b487d907de4dbf7c" + "url": "https://github.com/paragonie/random_compat.git", + "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/RandomLib/zipball/13efa4368bb2ac88bb3b1459b487d907de4dbf7c", - "reference": "13efa4368bb2ac88bb3b1459b487d907de4dbf7c", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d", + "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d", "shasum": "" }, "require": { - "ircmaxell/security-lib": "1.0.*@dev", - "php": ">=5.3.2" + "php": ">=5.2.0" }, "require-dev": { - "mikey179/vfsstream": "1.1.*", - "phpunit/phpunit": "3.7.*" + "phpunit/phpunit": "4.*|5.*" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, + "type": "library", "autoload": { - "psr-0": { - "RandomLib": "lib" - } + "files": [ + "lib/random.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -45,61 +41,99 @@ ], "authors": [ { - "name": "Anthony Ferrara", - "email": "ircmaxell@ircmaxell.com", - "homepage": "http://blog.ircmaxell.com" + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" } ], - "description": "A Library For Generating Secure Random Numbers", - "homepage": "https://github.com/ircmaxell/RandomLib", + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", "keywords": [ - "cryptography", - "random", - "random-numbers", - "random-strings" + "csprng", + "pseudorandom", + "random" ], - "time": "2015-01-15 16:31:45" + "time": "2017-03-13T16:27:32+00:00" }, { - "name": "ircmaxell/security-lib", - "version": "1.0.0", + "name": "paragonie/sodium_compat", + "version": "v0.7.0", "source": { "type": "git", - "url": "https://github.com/ircmaxell/SecurityLib.git", - "reference": "80934de3c482dcafb46b5756e59ebece082b6dc7" + "url": "https://github.com/paragonie/sodium_compat.git", + "reference": "775f3ffdd87c321533678c69542a09634567af05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/SecurityLib/zipball/80934de3c482dcafb46b5756e59ebece082b6dc7", - "reference": "80934de3c482dcafb46b5756e59ebece082b6dc7", + "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/775f3ffdd87c321533678c69542a09634567af05", + "reference": "775f3ffdd87c321533678c69542a09634567af05", "shasum": "" }, "require": { - "php": ">=5.3.2" + "paragonie/random_compat": "^1|^2", + "php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7" }, "require-dev": { - "mikey179/vfsstream": "1.1.*" + "phpunit/phpunit": "^3|^4|^5" + }, + "suggest": { + "ext-libsodium": "Better performance, password hashing (Argon2i), secure memory management (memzero), and better security." }, "type": "library", "autoload": { - "psr-0": { - "SecurityLib": "lib" - } + "files": [ + "autoload.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "ISC" ], "authors": [ { - "name": "Anthony Ferrara", - "email": "ircmaxell@ircmaxell.com", - "homepage": "http://blog.ircmaxell.com" + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com" + }, + { + "name": "Frank Denis", + "email": "jedisct1@pureftpd.org" } ], - "description": "A Base Security Library", - "homepage": "https://github.com/ircmaxell/PHP-SecurityLib", - "time": "2013-04-30 18:00:34" + "description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists", + "keywords": [ + "Authentication", + "BLAKE2b", + "ChaCha20", + "ChaCha20-Poly1305", + "Chapoly", + "Curve25519", + "Ed25519", + "EdDSA", + "Edwards-curve Digital Signature Algorithm", + "Elliptic Curve Diffie-Hellman", + "Poly1305", + "Pure-PHP cryptography", + "RFC 7748", + "RFC 8032", + "Salpoly", + "Salsa20", + "X25519", + "XChaCha20-Poly1305", + "XSalsa20-Poly1305", + "Xchacha20", + "Xsalsa20", + "aead", + "cryptography", + "ecdh", + "elliptic curve", + "elliptic curve cryptography", + "encryption", + "libsodium", + "php", + "public-key cryptography", + "secret-key cryptography", + "side-channel resistant" + ], + "time": "2017-04-12T20:13:51+00:00" } ], "packages-dev": [ @@ -148,7 +182,7 @@ "reflection", "tokenizer" ], - "time": "2014-08-06 16:37:08" + "time": "2014-08-06T16:37:08+00:00" }, { "name": "apigen/apigen", @@ -238,7 +272,7 @@ "generator", "phpdoc" ], - "time": "2015-04-09 13:42:45" + "time": "2015-04-09T13:42:45+00:00" }, { "name": "apigen/theme-bootstrap", @@ -274,7 +308,7 @@ ], "description": "Twitter Bootstrap theme for ApiGen", "homepage": "http://apigen.org/", - "time": "2015-03-30 17:49:49" + "time": "2015-03-30T17:49:49+00:00" }, { "name": "apigen/theme-default", @@ -322,7 +356,7 @@ ], "description": "Default theme for ApiGen", "homepage": "http://apigen.org/", - "time": "2015-03-30 17:50:03" + "time": "2015-03-30T17:50:03+00:00" }, { "name": "codeception/codeception", @@ -402,7 +436,7 @@ "functional testing", "unit testing" ], - "time": "2015-04-02 23:50:20" + "time": "2015-04-02T23:50:20+00:00" }, { "name": "codeception/specify", @@ -439,7 +473,7 @@ } ], "description": "BDD code blocks for PHPUnit and Codeception", - "time": "2014-10-17 00:06:51" + "time": "2014-10-17T00:06:51+00:00" }, { "name": "doctrine/instantiator", @@ -493,7 +527,7 @@ "constructor", "instantiate" ], - "time": "2014-10-13 12:58:55" + "time": "2014-10-13T12:58:55+00:00" }, { "name": "facebook/webdriver", @@ -534,7 +568,7 @@ "selenium", "webdriver" ], - "time": "2014-11-05 20:53:09" + "time": "2014-11-05T20:53:09+00:00" }, { "name": "guzzlehttp/guzzle", @@ -592,7 +626,7 @@ "rest", "web service" ], - "time": "2015-01-28 01:03:29" + "time": "2015-01-28T01:03:29+00:00" }, { "name": "guzzlehttp/ringphp", @@ -643,7 +677,7 @@ } ], "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", - "time": "2015-03-30 01:43:20" + "time": "2015-03-30T01:43:20+00:00" }, { "name": "guzzlehttp/streams", @@ -693,19 +727,19 @@ "Guzzle", "stream" ], - "time": "2014-10-12 19:18:40" + "time": "2014-10-12T19:18:40+00:00" }, { "name": "herrera-io/json", "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/herrera-io/php-json.git", + "url": "https://github.com/kherge-php/json.git", "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/herrera-io/php-json/zipball/60c696c9370a1e5136816ca557c17f82a6fa83f1", + "url": "https://api.github.com/repos/kherge-php/json/zipball/60c696c9370a1e5136816ca557c17f82a6fa83f1", "reference": "60c696c9370a1e5136816ca557c17f82a6fa83f1", "shasum": "" }, @@ -754,19 +788,20 @@ "schema", "validate" ], - "time": "2013-10-30 16:51:34" + "abandoned": "kherge/json", + "time": "2013-10-30T16:51:34+00:00" }, { "name": "herrera-io/phar-update", "version": "2.0.0", "source": { "type": "git", - "url": "https://github.com/herrera-io/php-phar-update.git", + "url": "https://github.com/kherge-abandoned/php-phar-update.git", "reference": "15643c90d3d43620a4f45c910e6afb7a0ad4b488" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/herrera-io/php-phar-update/zipball/15643c90d3d43620a4f45c910e6afb7a0ad4b488", + "url": "https://api.github.com/repos/kherge-abandoned/php-phar-update/zipball/15643c90d3d43620a4f45c910e6afb7a0ad4b488", "reference": "15643c90d3d43620a4f45c910e6afb7a0ad4b488", "shasum": "" }, @@ -812,19 +847,20 @@ "phar", "update" ], - "time": "2013-11-09 17:13:13" + "abandoned": true, + "time": "2013-11-09T17:13:13+00:00" }, { "name": "herrera-io/version", "version": "1.1.1", "source": { "type": "git", - "url": "https://github.com/herrera-io/php-version.git", + "url": "https://github.com/kherge-abandoned/php-version.git", "reference": "d39d9642b92a04d8b8a28b871b797a35a2545e85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/herrera-io/php-version/zipball/d39d9642b92a04d8b8a28b871b797a35a2545e85", + "url": "https://api.github.com/repos/kherge-abandoned/php-version/zipball/d39d9642b92a04d8b8a28b871b797a35a2545e85", "reference": "d39d9642b92a04d8b8a28b871b797a35a2545e85", "shasum": "" }, @@ -864,7 +900,8 @@ "semantic", "version" ], - "time": "2014-05-27 05:29:25" + "abandoned": true, + "time": "2014-05-27T05:29:25+00:00" }, { "name": "justinrainbow/json-schema", @@ -930,7 +967,7 @@ "json", "schema" ], - "time": "2015-03-27 16:41:39" + "time": "2015-03-27T16:41:39+00:00" }, { "name": "kdyby/events", @@ -1013,7 +1050,7 @@ "kdyby", "nette" ], - "time": "2015-04-04 16:29:31" + "time": "2015-04-04T16:29:31+00:00" }, { "name": "kukulich/fshl", @@ -1055,7 +1092,7 @@ "library", "syntax" ], - "time": "2012-09-08 19:00:07" + "time": "2012-09-08T19:00:07+00:00" }, { "name": "latte/latte", @@ -1115,7 +1152,7 @@ "templating", "twig" ], - "time": "2015-03-27 10:53:51" + "time": "2015-03-27T10:53:51+00:00" }, { "name": "michelf/php-markdown", @@ -1166,7 +1203,7 @@ "keywords": [ "markdown" ], - "time": "2015-03-01 12:03:08" + "time": "2015-03-01T12:03:08+00:00" }, { "name": "myclabs/deep-copy", @@ -1208,7 +1245,7 @@ "object", "object graph" ], - "time": "2015-03-21 22:40:23" + "time": "2015-03-21T22:40:23+00:00" }, { "name": "nette/application", @@ -1275,7 +1312,7 @@ ], "description": "Nette Application MVC Component", "homepage": "http://nette.org", - "time": "2015-03-23 22:45:31" + "time": "2015-03-23T22:45:31+00:00" }, { "name": "nette/bootstrap", @@ -1346,7 +1383,7 @@ ], "description": "Nette Bootstrap", "homepage": "http://nette.org", - "time": "2015-03-09 23:19:17" + "time": "2015-03-09T23:19:17+00:00" }, { "name": "nette/caching", @@ -1404,7 +1441,7 @@ ], "description": "Nette Caching Component", "homepage": "http://nette.org", - "time": "2015-03-24 16:06:30" + "time": "2015-03-24T16:06:30+00:00" }, { "name": "nette/component-model", @@ -1454,7 +1491,7 @@ ], "description": "Nette Component Model", "homepage": "http://nette.org", - "time": "2015-02-06 14:13:18" + "time": "2015-02-06T14:13:18+00:00" }, { "name": "nette/di", @@ -1511,7 +1548,7 @@ ], "description": "Nette Dependency Injection Component", "homepage": "http://nette.org", - "time": "2015-04-08 13:52:20" + "time": "2015-04-08T13:52:20+00:00" }, { "name": "nette/finder", @@ -1566,7 +1603,7 @@ ], "description": "Nette Finder: Files Searching", "homepage": "http://nette.org", - "time": "2015-02-17 20:36:43" + "time": "2015-02-17T20:36:43+00:00" }, { "name": "nette/http", @@ -1625,7 +1662,7 @@ ], "description": "Nette HTTP Component", "homepage": "http://nette.org", - "time": "2015-02-25 00:17:52" + "time": "2015-02-25T00:17:52+00:00" }, { "name": "nette/mail", @@ -1685,7 +1722,7 @@ ], "description": "Nette Mail: Sending E-mails", "homepage": "http://nette.org", - "time": "2015-02-24 22:24:13" + "time": "2015-02-24T22:24:13+00:00" }, { "name": "nette/neon", @@ -1737,7 +1774,7 @@ ], "description": "Nette NEON: parser & generator for Nette Object Notation", "homepage": "http://ne-on.org", - "time": "2015-03-26 20:37:13" + "time": "2015-03-26T20:37:13+00:00" }, { "name": "nette/php-generator", @@ -1792,7 +1829,7 @@ ], "description": "Nette PHP Generator", "homepage": "http://nette.org", - "time": "2015-02-18 17:11:05" + "time": "2015-02-18T17:11:05+00:00" }, { "name": "nette/reflection", @@ -1850,7 +1887,7 @@ ], "description": "Nette PHP Reflection Component", "homepage": "http://nette.org", - "time": "2015-02-16 15:33:50" + "time": "2015-02-16T15:33:50+00:00" }, { "name": "nette/robot-loader", @@ -1907,7 +1944,7 @@ ], "description": "Nette RobotLoader: comfortable autoloading", "homepage": "http://nette.org", - "time": "2015-02-05 13:03:37" + "time": "2015-02-05T13:03:37+00:00" }, { "name": "nette/safe-stream", @@ -1961,7 +1998,7 @@ ], "description": "Nette SafeStream: Atomic Operations", "homepage": "http://nette.org", - "time": "2015-01-27 13:35:41" + "time": "2015-01-27T13:35:41+00:00" }, { "name": "nette/security", @@ -2013,7 +2050,7 @@ ], "description": "Nette Security: Access Control Component", "homepage": "http://nette.org", - "time": "2015-02-24 20:35:28" + "time": "2015-02-24T20:35:28+00:00" }, { "name": "nette/utils", @@ -2073,7 +2110,7 @@ ], "description": "Nette Utility Classes", "homepage": "http://nette.org", - "time": "2015-03-17 21:49:28" + "time": "2015-03-17T21:49:28+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -2122,7 +2159,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2015-02-03T12:10:50+00:00" }, { "name": "phpspec/prophecy", @@ -2182,7 +2219,7 @@ "spy", "stub" ], - "time": "2015-03-27 19:31:25" + "time": "2015-03-27T19:31:25+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2244,7 +2281,7 @@ "testing", "xunit" ], - "time": "2015-04-11 04:35:00" + "time": "2015-04-11T04:35:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2289,7 +2326,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2013-10-10T15:34:57+00:00" }, { "name": "phpunit/php-text-template", @@ -2333,7 +2370,7 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2014-01-30T17:20:04+00:00" }, { "name": "phpunit/php-timer", @@ -2377,7 +2414,7 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2013-08-02T07:42:54+00:00" }, { "name": "phpunit/php-token-stream", @@ -2426,7 +2463,7 @@ "keywords": [ "tokenizer" ], - "time": "2015-04-08 04:46:07" + "time": "2015-04-08T04:46:07+00:00" }, { "name": "phpunit/phpunit", @@ -2498,7 +2535,7 @@ "testing", "xunit" ], - "time": "2015-03-29 09:24:05" + "time": "2015-03-29T09:24:05+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -2553,7 +2590,7 @@ "mock", "xunit" ], - "time": "2015-04-02 05:36:41" + "time": "2015-04-02T05:36:41+00:00" }, { "name": "react/promise", @@ -2597,7 +2634,7 @@ } ], "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "time": "2014-12-30 13:32:42" + "time": "2014-12-30T13:32:42+00:00" }, { "name": "sebastian/comparator", @@ -2661,7 +2698,7 @@ "compare", "equality" ], - "time": "2015-01-29 16:28:08" + "time": "2015-01-29T16:28:08+00:00" }, { "name": "sebastian/diff", @@ -2713,7 +2750,7 @@ "keywords": [ "diff" ], - "time": "2015-02-22 15:13:53" + "time": "2015-02-22T15:13:53+00:00" }, { "name": "sebastian/environment", @@ -2763,7 +2800,7 @@ "environment", "hhvm" ], - "time": "2015-01-01 10:01:08" + "time": "2015-01-01T10:01:08+00:00" }, { "name": "sebastian/exporter", @@ -2829,7 +2866,7 @@ "export", "exporter" ], - "time": "2015-01-27 07:23:06" + "time": "2015-01-27T07:23:06+00:00" }, { "name": "sebastian/global-state", @@ -2880,7 +2917,7 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2014-10-06T09:23:50+00:00" }, { "name": "sebastian/recursion-context", @@ -2933,7 +2970,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-01-24 09:48:32" + "time": "2015-01-24T09:48:32+00:00" }, { "name": "sebastian/version", @@ -2968,7 +3005,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-02-24 06:35:25" + "time": "2015-02-24T06:35:25+00:00" }, { "name": "seld/jsonlint", @@ -3014,7 +3051,7 @@ "parser", "validator" ], - "time": "2015-01-04 21:18:15" + "time": "2015-01-04T21:18:15+00:00" }, { "name": "symfony/browser-kit", @@ -3022,12 +3059,12 @@ "target-dir": "Symfony/Component/BrowserKit", "source": { "type": "git", - "url": "https://github.com/symfony/BrowserKit.git", + "url": "https://github.com/symfony/browser-kit.git", "reference": "f21189b0eccbe56528515858ca1d5089a741692f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/f21189b0eccbe56528515858ca1d5089a741692f", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/f21189b0eccbe56528515858ca1d5089a741692f", "reference": "f21189b0eccbe56528515858ca1d5089a741692f", "shasum": "" }, @@ -3070,7 +3107,7 @@ ], "description": "Symfony BrowserKit Component", "homepage": "http://symfony.com", - "time": "2015-03-30 15:54:10" + "time": "2015-03-30T15:54:10+00:00" }, { "name": "symfony/console", @@ -3078,12 +3115,12 @@ "target-dir": "Symfony/Component/Console", "source": { "type": "git", - "url": "https://github.com/symfony/Console.git", + "url": "https://github.com/symfony/console.git", "reference": "5b91dc4ed5eb08553f57f6df04c4730a73992667" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/5b91dc4ed5eb08553f57f6df04c4730a73992667", + "url": "https://api.github.com/repos/symfony/console/zipball/5b91dc4ed5eb08553f57f6df04c4730a73992667", "reference": "5b91dc4ed5eb08553f57f6df04c4730a73992667", "shasum": "" }, @@ -3128,7 +3165,7 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2015-03-30 15:54:10" + "time": "2015-03-30T15:54:10+00:00" }, { "name": "symfony/css-selector", @@ -3136,12 +3173,12 @@ "target-dir": "Symfony/Component/CssSelector", "source": { "type": "git", - "url": "https://github.com/symfony/CssSelector.git", + "url": "https://github.com/symfony/css-selector.git", "reference": "db2c48df9658423a8c168d89f7b971b73d3d74a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/db2c48df9658423a8c168d89f7b971b73d3d74a4", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/db2c48df9658423a8c168d89f7b971b73d3d74a4", "reference": "db2c48df9658423a8c168d89f7b971b73d3d74a4", "shasum": "" }, @@ -3182,7 +3219,7 @@ ], "description": "Symfony CssSelector Component", "homepage": "http://symfony.com", - "time": "2015-03-22 16:55:57" + "time": "2015-03-22T16:55:57+00:00" }, { "name": "symfony/dom-crawler", @@ -3190,12 +3227,12 @@ "target-dir": "Symfony/Component/DomCrawler", "source": { "type": "git", - "url": "https://github.com/symfony/DomCrawler.git", + "url": "https://github.com/symfony/dom-crawler.git", "reference": "8897ebf39c7dfb752a5494fa301845a3fbb9e53d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/8897ebf39c7dfb752a5494fa301845a3fbb9e53d", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/8897ebf39c7dfb752a5494fa301845a3fbb9e53d", "reference": "8897ebf39c7dfb752a5494fa301845a3fbb9e53d", "shasum": "" }, @@ -3236,7 +3273,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "http://symfony.com", - "time": "2015-03-30 15:54:10" + "time": "2015-03-30T15:54:10+00:00" }, { "name": "symfony/event-dispatcher", @@ -3244,12 +3281,12 @@ "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", + "url": "https://github.com/symfony/event-dispatcher.git", "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/70f7c8478739ad21e3deef0d977b38c77f1fb284", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/70f7c8478739ad21e3deef0d977b38c77f1fb284", "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284", "shasum": "" }, @@ -3295,7 +3332,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2015-03-13 17:37:22" + "time": "2015-03-13T17:37:22+00:00" }, { "name": "symfony/finder", @@ -3345,7 +3382,7 @@ ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2015-03-30 15:54:10" + "time": "2015-03-30T15:54:10+00:00" }, { "name": "symfony/options-resolver", @@ -3353,12 +3390,12 @@ "target-dir": "Symfony/Component/OptionsResolver", "source": { "type": "git", - "url": "https://github.com/symfony/OptionsResolver.git", + "url": "https://github.com/symfony/options-resolver.git", "reference": "d619503992eea05eb407a6db76e28dc1b7619416" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/d619503992eea05eb407a6db76e28dc1b7619416", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/d619503992eea05eb407a6db76e28dc1b7619416", "reference": "d619503992eea05eb407a6db76e28dc1b7619416", "shasum": "" }, @@ -3400,7 +3437,7 @@ "configuration", "options" ], - "time": "2015-03-13 17:37:22" + "time": "2015-03-13T17:37:22+00:00" }, { "name": "symfony/yaml", @@ -3450,7 +3487,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2015-03-30 15:54:10" + "time": "2015-03-30T15:54:10+00:00" }, { "name": "tracy/tracy", @@ -3510,7 +3547,7 @@ "debugger", "nette" ], - "time": "2015-03-27 10:21:19" + "time": "2015-03-27T10:21:19+00:00" } ], "aliases": [], diff --git a/src/ShortId.php b/src/ShortId.php index 800f618..42d70cf 100644 --- a/src/ShortId.php +++ b/src/ShortId.php @@ -10,8 +10,6 @@ namespace Crisu83\ShortId; -use RandomLib\Factory; - /** * Class ShortId * @package Crisu83\ShortId @@ -30,10 +28,6 @@ class ShortId * @var string alphabet to use when generating the identifier (must be 64 characters long) */ private $_alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-'; - /** - * @var \RandomLib\Generator random generator instance. - */ - private $_randomGenerator; /** * Creates a new generator. @@ -50,8 +44,14 @@ public function __construct(array $config = []) */ public function generate() { - return $this->getRandomGenerator() - ->generateString($this->_length, $this->_alphabet); + $str = ''; + $keysize = strlen($this->_alphabet); + + for ($i = 0; $i < $this->_length; ++$i) { + $str .= $this->_alphabet[\Sodium\randombytes_uniform($keysize)]; + } + + return $str; } /** @@ -119,20 +119,6 @@ protected function assertAlphabet($alphabet) } } - /** - * Returns the random generator instance (creating it if necessary). - * @return \RandomLib\Generator random generator instance. - */ - protected function getRandomGenerator() - { - if (null === $this->_randomGenerator) { - $factory = new Factory(); - $this->_randomGenerator = $factory->getMediumStrengthGenerator(); - } - - return $this->_randomGenerator; - } - /** * Static factory method that creates a new generator. * @param array $config generator configuration