* @author Marcin Łojewski * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ namespace Tests\UserSQL\Crypto; use OCA\UserSQL\Crypto\IPasswordAlgorithm; use OCA\UserSQL\Crypto\SHA512; use OCP\IL10N; use Test\TestCase; /** * Unit tests for class SHA512. * * @author Marcin Łojewski */ class SHA512Test extends TestCase { /** * @var IPasswordAlgorithm */ private $crypto; public function testCheckPassword() { $this->assertTrue( $this->crypto->checkPassword( "password", "b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86" ) ); } public function testPasswordHash() { $hash = $this->crypto->getPasswordHash("password"); $this->assertTrue($this->crypto->checkPassword("password", $hash)); } protected function setUp() { parent::setUp(); $this->crypto = new SHA512($this->createMock(IL10N::class)); } }