. */ namespace danog\MadelineProto; class RSA extends TL\TL { public $key; // phpseclib\Crypt\RSA class public $n; // phpseclib\Math\BigInteger class public $e; // phpseclib\Math\BigInteger class public $fp; // phpseclib\Math\BigInteger class public $fp_float; // float public function __construct($key) { $this->key = new \phpseclib\Crypt\RSA(); $this->key->load($key); $this->n = $this->key->modulus; $this->e = $this->key->exponent; $this->fp = new \phpseclib\Math\BigInteger(strrev(substr(sha1($this->serialize_param('bytes', $this->n->toBytes()) . $this->serialize_param('bytes', $this->e->toBytes()), true), -8)), -256); $this->fp_float = (float) $this->fp->toString(); } public function encrypt($data) { $bigintdata = new \phpseclib\Math\BigInteger($data, 256); return $bigintdata->powMod($this->e, $this->n)->toBytes(); } }