From 681178ecc75da637fd854a326842fddef0ebf48b Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Sun, 17 Nov 2024 14:19:44 -0500 Subject: [PATCH] Fix for some failed logins --- Source/Framework/Cryptography/SRP6.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Framework/Cryptography/SRP6.cs b/Source/Framework/Cryptography/SRP6.cs index 5903f2727..3fa779bf6 100644 --- a/Source/Framework/Cryptography/SRP6.cs +++ b/Source/Framework/Cryptography/SRP6.cs @@ -328,11 +328,13 @@ namespace Framework.Cryptography BigInteger x = new(xBytes, true, true); if ((xBytes[0] & 0x80) != 0) { - byte[] fix = new byte[65]; - fix[64] = 1; + byte[] fix = [1, ..new byte[64]]; x -= new BigInteger(fix, true); } + if (x.Sign == -1) + return x += N - 1; + return x % (N - 1); }