diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-12-05 19:28:56 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-12-05 19:28:56 +0700 |
commit | b9d47a217206ee5980f03252b59d5934084275fd (patch) | |
tree | 25a4b7996a2f7982dd0847d7d98b73c91aa3cb4d | |
parent | Always apply sign guard (diff) | |
download | BouncyCastle.NET-ed25519-b9d47a217206ee5980f03252b59d5934084275fd.tar.xz |
Add ECFieldElement.GetEncoded() method
-rw-r--r-- | crypto/src/math/ec/ECFieldElement.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/src/math/ec/ECFieldElement.cs b/crypto/src/math/ec/ECFieldElement.cs index 5235c6c0e..1205cdbcb 100644 --- a/crypto/src/math/ec/ECFieldElement.cs +++ b/crypto/src/math/ec/ECFieldElement.cs @@ -33,7 +33,7 @@ namespace Org.BouncyCastle.Math.EC return Equals(other); } - protected bool Equals( + protected virtual bool Equals( ECFieldElement other) { return ToBigInteger().Equals(other.ToBigInteger()); @@ -48,7 +48,12 @@ namespace Org.BouncyCastle.Math.EC { return this.ToBigInteger().ToString(2); } - } + + public virtual byte[] GetEncoded() + { + return BigIntegers.AsUnsignedByteArray((FieldSize + 7) / 8, ToBigInteger()); + } + } public class FpFieldElement : ECFieldElement |