<?php namespace mindplay\blowfish; use RuntimeException; BlowfishService::init(); /** * This class provides a simple wrapper around the Blowfish cipher. * * This class will throw (immediately on load) on PHP versions prior to 5.3.7, which * had a broken implementation of the Blowfish algorithm (and/or would fall back to DES.) * * http://www.php.net/security/crypt_blowfish.php */ class BlowfishService { /** @type int salt length required for Blowfish algorithm */ const SALT_LENGTH = 16; /** @type string path to the dev/urandom device on Linux */ const DEV_URANDOM = '/dev/urandom'; /** @type string minimum PHP version with proper Blowfish support */ const MIN_PHP_VERSION = '5.3.7'; /** * @var int cryptographic cost of the Blowfish algorithm */ private $_cost; /** * @param int $cost cost (iteration count) for the underlying Blowfish-based hashing algorithm (range 4 to 31) * * @throws RuntimeException for invalid $cost */