update ciphers

This commit is contained in:
printempw 2016-10-30 14:12:22 +08:00
parent 6aaec6f658
commit f71190e286
8 changed files with 77 additions and 24 deletions

View File

@ -29,7 +29,7 @@ DB_PREFIX = null
# Encrypt Method for Passwords.
#
# Available values: MD5, SALTED2MD5, SHA256
# Available values: MD5, SALTED2MD5, (SALTED2)SHA256, (SALTED2)SHA512
PWD_METHOD = SALTED2MD5
# Salt

View File

@ -0,0 +1,21 @@
<?php
namespace App\Events;
use App\Models\Player;
class PlayerWillBeAdded extends Event
{
public $playerName;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($player_name)
{
$this->playerName = $player_name;
}
}

View File

@ -13,6 +13,7 @@ use Illuminate\Http\Request;
use App\Events\PlayerWasAdded;
use App\Events\PlayerWasDeleted;
use App\Events\CheckPlayerExists;
use App\Events\PlayerWillBeAdded;
use App\Exceptions\PrettyPageException;
use App\Services\Repositories\UserRepository;
@ -61,6 +62,8 @@ class PlayerController extends Controller
return json(trans('user.player.add.lack-score'), 7);
}
Event::fire(new PlayerWillBeAdded($request->input('player_name')));
$player = new Player;
$player->uid = $this->user->uid;

View File

@ -1,22 +0,0 @@
<?php
namespace App\Services\Cipher;
class CrazyCrypt1 implements EncryptInterface
{
/**
* Fucking CrazyCrypt1
*
* https://github.com/ST-DDT/CrazyLogin/blob/master/php/Encryptors/CrazyCrypt1.php
*/
public function encrypt($raw_passwd, $salt = "") {
// salt is username
$text = "ÜÄaeut//&/=I " . $raw_passwd . "7421€547" . $salt . "__+IÄIH§%NK " . $raw_passwd;
$t1 = unpack("H*", $text);
$t2 = substr($t1[1], 0, mb_strlen($text, 'UTF-8')*2);
$t3 = pack("H*", $t2);
$encrypt = hash("sha512", $t3);
return $encrypt;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Services\Cipher;
class SHA256 implements EncryptInterface
{
/**
* Default SHA256 encryption method for Authme
*
* @see http://pastebin.com/1wy9g2HT
*/
public function encrypt($raw_passwd, $salt = "") {
$encrypt = hash('sha256', hash('sha256', $raw_passwd).$salt);
return $encrypt;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Services\Cipher;
class SHA256 implements EncryptInterface
{
/**
* Default SHA256 encryption method for Authme
*
* @see http://pastebin.com/1wy9g2HT
*/
public function encrypt($raw_passwd, $salt = "") {
$encrypt = hash('sha512', hash('sha256', $raw_passwd).$salt);
return $encrypt;
}
}

View File

@ -10,7 +10,7 @@ class SHA256 implements EncryptInterface
* @see http://pastebin.com/1wy9g2HT
*/
public function encrypt($raw_passwd, $salt = "") {
$encrypt = hash('sha256', hash('sha256', $raw_passwd).$salt);
$encrypt = hash('sha256', $raw_passwd);
return $encrypt;
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Services\Cipher;
class SHA256 implements EncryptInterface
{
/**
* Default SHA256 encryption method for Authme
*
* @see http://pastebin.com/1wy9g2HT
*/
public function encrypt($raw_passwd, $salt = "") {
$encrypt = hash('sha512', $raw_passwd);
return $encrypt;
}
}