示例#1
0
     *
     * @return string The converted representation
     */
    protected function to64($input)
    {
        $output = '';
        $count = strlen($input);
        $ictr = 0;
        do {
            $value = ord($input[$ictr++]);
            $output .= static::$itoa[$value & 0x3f];
            if ($ictr < $count) {
                $value |= ord($input[$ictr]) << 8;
            }
            $output .= static::$itoa[$value >> 6 & 0x3f];
            if ($ictr++ >= $count) {
                break;
            }
            if ($ictr < $count) {
                $value |= ord($input[$ictr]) << 16;
            }
            $output .= static::$itoa[$value >> 12 & 0x3f];
            if ($ictr++ < $count) {
                $output .= static::$itoa[$value >> 18 & 0x3f];
            }
        } while ($ictr < $count);
        return $output;
    }
}
PHPASS::init();
示例#2
0
 /**
  * @covers CryptLib\Password\Implementation\PHPASS::verify
  * @dataProvider provideTestVerify
  * @group Vectors
  */
 public function testVerify($pass, $expect, $value)
 {
     $apr = new PHPASS();
     $this->assertEquals($value, $apr->verify($pass, $expect));
 }
示例#3
0
 /**
  * @covers CryptLib\Password\Implementation\PHPASS
  */
 public function testCreateAndVerify()
 {
     $hash = new PHPASS(10);
     $test = $hash->create('Foobar');
     $this->assertTrue($hash->verify('Foobar', $test));
 }