承接 kijin/phprandom 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kijin/phprandom

Composer 安装命令:

composer require kijin/phprandom

包简介

Just another random number/string generator for PHP 5

关键字:

README 文档

README

Just another random number/string generator for PHP 5

This library is similar to ircmaxell/RandomLib, except it is compatible with PHP 5.0 and above, and comes with a much simpler interface. Seriously, PHP ain't Java. Why do we need a dozen files and classes inheriting one another just to get some random bytes? :p

How to Install

Traditional method:

include 'phprandom.php';

Composer:

"require": {
    "kijin/phprandom": "dev-master"
}

How to Use

Get a random integer between two endpoints (inclusive):

$random = PHPRandom::getInteger($min, $max);

Get a random floating-point number between 0 and 1:

$random = PHPRandom::getFloat();

Get a random alphanumeric string (0-9, a-z, A-Z):

$random = PHPRandom::getString($length);

Get a random hexademical string (0-9, a-f):

$random = PHPRandom::getHexString($length);

Get a random binary string:

$random = PHPRandom::getBinary($length);

Find out where your precious entropy comes from:

$sources = PHPRandom::listSources();

Configuration

PHPRandom requires no configuration.

You don't have to choose whether you want low-quality or high-quality entropy. You always get the highest quality of entropy that your system supports. Since the marginal cost of asking for high-quality entropy is negligible in most cases, there is rarely any need to ask for low-quality entropy.

Weaker sources of entropy are automatically mixed with other sources using the best mixing algorithm that your system supports.

Supported sources, in order of preference:

  • openssl_random_pseudo_bytes()
  • mcrypt_create_iv() with MCRYPT_DEV_URANDOM
  • mcrypt_create_iv() with MCRYPT_RAND (Windows only)
  • /dev/urandom (Linux/Unix only)
  • rand() xor mt_rand()

Supported mixers, in order of preference:

  • hash_hmac() with SHA-256
  • sha1()

License

PHPRandom is free software released under the MIT license.

统计信息

  • 总下载量: 1.16k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固