init commit

This commit is contained in:
2025-10-09 09:57:24 +09:00
commit 4d551bd74f
6636 changed files with 1218703 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
using System;
using Org.BouncyCastle.Math;
namespace Org.BouncyCastle.Crypto.Parameters;
public class DsaParameters : ICipherParameters
{
private readonly BigInteger p;
private readonly BigInteger q;
private readonly BigInteger g;
private readonly DsaValidationParameters validation;
public BigInteger P => p;
public BigInteger Q => q;
public BigInteger G => g;
public DsaValidationParameters ValidationParameters => validation;
public DsaParameters(BigInteger p, BigInteger q, BigInteger g)
: this(p, q, g, null)
{
}
public DsaParameters(BigInteger p, BigInteger q, BigInteger g, DsaValidationParameters parameters)
{
if (p == null)
{
throw new ArgumentNullException("p");
}
if (q == null)
{
throw new ArgumentNullException("q");
}
if (g == null)
{
throw new ArgumentNullException("g");
}
this.p = p;
this.q = q;
this.g = g;
validation = parameters;
}
public override bool Equals(object obj)
{
if (obj == this)
{
return true;
}
if (!(obj is DsaParameters other))
{
return false;
}
return Equals(other);
}
protected bool Equals(DsaParameters other)
{
if (p.Equals(other.p) && q.Equals(other.q))
{
return g.Equals(other.g);
}
return false;
}
public override int GetHashCode()
{
return p.GetHashCode() ^ q.GetHashCode() ^ g.GetHashCode();
}
}