in src/Amazon.Extensions.CognitoAuthentication/Util/BigIntegerExtensions.cs [22:26]
public static BigInteger TrueMod(this BigInteger self, BigInteger other)
{
var remainder = self % other;
return remainder.Sign >= 0 ? remainder : remainder + other;
}