示例#1
0
文件: Mcrypt.php 项目: lytc/sloths
 /**
  * @param $size
  * @return string
  */
 public static function createRandomKey($size)
 {
     if ($size instanceof self) {
         $size = $size->getMaxKeySize();
     }
     return StringUtils::random($size, StringUtils::RANDOM_ALL);
 }
示例#2
0
 /**
  * @dataProvider randomDataProvider
  */
 public function testRandom($format, $flags = StringUtils::RANDOM_ALNUM)
 {
     $str = StringUtils::random(100, $flags);
     $this->assertSame(100, strlen($str));
     $this->assertRegExp($format, $str);
 }