File: test/unit/PasswordTest.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Halite  >  test/unit/PasswordTest.php  >  Download  
File: test/unit/PasswordTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Halite
Perform cryptography operations with libsodium
Author: By
Last change:
Date: 5 years ago
Size: 639 bytes
 

 

Contents

Class file image Download
<?php
use \ParagonIE\Halite\Password;
use
ParagonIE\Halite\Symmetric\EncryptionKey;

/**
 * @backupGlobals disabled
 * @backupStaticAttributes disabled
 */
class PasswordTest extends PHPUnit_Framework_TestCase
{
    public function
testEncrypt()
    {
       
$key = new EncryptionKey(\str_repeat('A', 32));
       
       
$hash = Password::hash('test password', $key);
       
$this->assertTrue(is_string($hash));
       
       
$this->assertTrue(
           
Password::verify('test password', $hash, $key)
        );
       
       
$this->assertFalse(
           
Password::verify('wrong password', $hash, $key)
        );
    }
}


For more information send a message to info at phpclasses dot org.