Remove last reference

This commit is contained in:
Daniil Gentili 2020-02-01 16:25:45 +01:00
parent 6b0aaca08c
commit e78be0ba49
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -19,7 +19,6 @@
namespace danog\MadelineProto\Stream\MTProtoTransport;
use danog\MadelineProto\Stream\Async\Stream;
use danog\MadelineProto\Stream\BufferedProxyStreamInterface;
use danog\MadelineProto\Stream\Common\CtrStream;
use danog\MadelineProto\Stream\ConnectionContext;
@ -33,7 +32,6 @@ use danog\MadelineProto\Stream\ConnectionContext;
*/
class ObfuscatedStream extends CtrStream implements BufferedProxyStreamInterface
{
use Stream;
private $stream;
private $extra;
/**
@ -47,7 +45,7 @@ class ObfuscatedStream extends CtrStream implements BufferedProxyStreamInterface
{
if (isset($this->extra['address'])) {
$ctx = $ctx->getCtx();
$ctx->setUri('tcp://' . $this->extra['address'] . ':' . $this->extra['port']);
$ctx->setUri('tcp://'.$this->extra['address'].':'.$this->extra['port']);
}
do {
$random = \danog\MadelineProto\Tools::random(64);
@ -55,14 +53,14 @@ class ObfuscatedStream extends CtrStream implements BufferedProxyStreamInterface
if (\strlen($header) === 1) {
$header = \str_repeat($header, 4);
}
$random = \substr_replace($random, $header . \substr($random, 56 + \strlen($header)), 56);
$random = \substr_replace($random, \pack('s', $ctx->getIntDc()) . \substr($random, 60 + 2), 60);
$random = \substr_replace($random, $header.\substr($random, 56 + \strlen($header)), 56);
$random = \substr_replace($random, \pack('s', $ctx->getIntDc()).\substr($random, 60 + 2), 60);
$reversed = \strrev($random);
$key = \substr($random, 8, 32);
$keyRev = \substr($reversed, 8, 32);
if (isset($this->extra['secret'])) {
$key = \hash('sha256', $key . $this->extra['secret'], true);
$keyRev = \hash('sha256', $keyRev . $this->extra['secret'], true);
$key = \hash('sha256', $key.$this->extra['secret'], true);
$keyRev = \hash('sha256', $keyRev.$this->extra['secret'], true);
}
$iv = \substr($random, 40, 16);
$ivRev = \substr($reversed, 40, 16);