1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-13 09:37:37 +01:00

[feature/elliptic-curve] Rename $q to $max because that's what it is.

This commit is contained in:
Andreas Fischer 2013-06-07 00:47:37 +02:00
parent 50f5f3f97e
commit 97cf60900d

View File

@ -1194,12 +1194,11 @@ class Net_SSH2 {
-- http://tools.ietf.org/html/rfc4419#section-6.2 */
$one = new Math_BigInteger(1);
$q = $one->bitwise_leftShift(16 * $keyLength); // 2 * 8 * $keyLength
$q = $q->subtract($one);
$max = $one->bitwise_leftShift(16 * $keyLength)->subtract($one); // 2 * 8 * $keyLength
$g = new Math_BigInteger(2);
$x = new Math_BigInteger();
$x = $x->random($one, $q);
$x = $x->random($one, $max);
$e = $g->modPow($x, $p);
$eBytes = $e->toBytes(true);