<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.0" />

Mod

static class Mod
Modular inversion as implemented in this class is based on the paper "Fast constant-time gcd computation and modular inversion" by Daniel J. Bernstein and Bo-Yin Yang.
public static void CheckedModOddInverse(ReadOnlySpan<uint> m, ReadOnlySpan<uint> x, Span<uint> z)

public static void CheckedModOddInverseVar(ReadOnlySpan<uint> m, ReadOnlySpan<uint> x, Span<uint> z)

public static uint Inverse32(uint d)

public static ulong Inverse64(ulong d)

public static uint ModOddInverse(ReadOnlySpan<uint> m, ReadOnlySpan<uint> x, Span<uint> z)

public static bool ModOddInverseVar(ReadOnlySpan<uint> m, ReadOnlySpan<uint> x, Span<uint> z)

public static uint ModOddIsCoprime(ReadOnlySpan<uint> m, ReadOnlySpan<uint> x)

public static bool ModOddIsCoprimeVar(ReadOnlySpan<uint> m, ReadOnlySpan<uint> x)

public static uint[] Random(SecureRandom random, uint[] p)

public static void Random(SecureRandom random, ReadOnlySpan<uint> p, Span<uint> z)