2017 © Pedro Peláez
 

library random

Cryptographically secure random data generation.

image

bfrohs/random

Cryptographically secure random data generation.

  • Monday, February 29, 2016
  • by bfrohs
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Random

Cryptographically secure random data generation., (*1)

Usage

Hex string

Random string of hexadecimal characters ([0-9a-f])., (*2)

use bfrohs\Random\Random;

$string = Random::generateHex(32);

var_dump($string);

string(32) "112321ec33df8ebc9234ac02dbae4277", (*3)

Url-safe string

Random string that is safe for use in URLs (unreserved characters) per RFC 3986 § 2.3 ([a-zA-Z0-9], _, ~, -, and .)., (*4)

use bfrohs\Random\Random;

$string = Random::generateUrlSafeString(32);

var_dump($string);

string(32) "XQ_7J495ZWd3s~5TWz-FNFiPkeM3z9K.", (*5)

Binary

Random bytes., (*6)

use bfrohs\Random\Random;

$string = Random::generateBinary(32);

// Note the use of `bin2hex()` to make output readable
var_dump(bin2hex($string));

string(64) "68a74f84be34c9be12ecada360e91639fd0d41cfae368d90fe8cc4c4ff66eed3", (*7)

Integer

Random integer., (*8)

use bfrohs\Random\Random;

$string = Random::generateInt(0, 29524);

var_dump($string);

int(12860), (*9)

The Versions

29/02 2016

dev-master

9999999-dev

Cryptographically secure random data generation.

  Sources   Download

MIT

The Requires

 

random hex csprng pseudorandom

29/02 2016

1.1.0

1.1.0.0

Cryptographically secure random data generation.

  Sources   Download

MIT

The Requires

 

random hex csprng pseudorandom

26/02 2016

1.0.0

1.0.0.0

Cryptographically secure random hex string generation.

  Sources   Download

MIT

The Requires

 

random hex csprng pseudorandom