app/Http/Middleware/UserCliente.php
/**
     * Computes private key using salt and identity which is derived from username and password
     *
     * @param  string  $p  User's password in plaintext
     *
     * @return BigInteger
     */
Computes private key using salt and identity which is derived from username and password
@param  string  $p  User's password in plaintext


Computes private key using salt and identity which is derived from username and password @param string $p User ' s password in plaintext
public function computePrivateKey(string $p): BigInteger
    {
        if (empty($this->salt)) {
            throw new RuntimeException('Received empty salt.');
        }
        if (empty($this->username)) {
            throw new RuntimeException('Received empty username.');
        }
        $salt = $this->reverseHex($this->salt);
        $salt = hex2bin($salt);
        $identity = hash('sha1', strtoupper($this->username.':'.$p), true);
        $sha = sha1($salt.$identity);
        $sha = $this->reverseHex($sha);
        return new BigInteger($sha, 16);
    }
public function computePrivateKey ( string $ p ) : BigInteger { if ( empty ( $ this -> salt ) ) { throw new RuntimeException ( 'Received empty salt.' ) ; } if ( empty ( $ this -> username ) ) { throw new RuntimeException ( 'Received empty username.' ) ; } $ salt = $ this -> reverseHex ( $ this -> salt ) ; $ salt = hex2bin ( $ salt ) ; $ identity = hash ( 'sha1' , strtoupper ( $ this -> username . ':' . $ p ) , true ) ; $ sha = sha1 ( $ salt . $ identity ) ; $ sha = $ this -> reverseHex ( $ sha ) ; return new BigInteger ( $ sha , 16 ) ; }
Computes private key using salt and identity which is derived from username and password
 @param  string  $p  User's password in plaintext
Computes private key using salt and identity which is derived from username and password @param string $p User ' s password in plaintext