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,44 @@
using System;
namespace Org.BouncyCastle.Math.EC;
public abstract class ECPointBase : ECPoint
{
protected internal ECPointBase(ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression)
: base(curve, x, y, withCompression)
{
}
protected internal ECPointBase(ECCurve curve, ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression)
: base(curve, x, y, zs, withCompression)
{
}
public override byte[] GetEncoded(bool compressed)
{
if (base.IsInfinity)
{
return new byte[1];
}
ECPoint eCPoint = Normalize();
byte[] encoded = eCPoint.XCoord.GetEncoded();
if (compressed)
{
byte[] array = new byte[encoded.Length + 1];
array[0] = (byte)(eCPoint.CompressionYTilde ? 3u : 2u);
Array.Copy(encoded, 0, array, 1, encoded.Length);
return array;
}
byte[] encoded2 = eCPoint.YCoord.GetEncoded();
byte[] array2 = new byte[encoded.Length + encoded2.Length + 1];
array2[0] = 4;
Array.Copy(encoded, 0, array2, 1, encoded.Length);
Array.Copy(encoded2, 0, array2, encoded.Length + 1, encoded2.Length);
return array2;
}
public override ECPoint Multiply(BigInteger k)
{
return Curve.GetMultiplier().Multiply(this, k);
}
}