summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/math/ec/ECFieldElement.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/src/math/ec/ECFieldElement.cs b/crypto/src/math/ec/ECFieldElement.cs
index 22cd1e0e8..ac9c62807 100644
--- a/crypto/src/math/ec/ECFieldElement.cs
+++ b/crypto/src/math/ec/ECFieldElement.cs
@@ -1166,7 +1166,15 @@ namespace Org.BouncyCastle.Math.EC
 
         public override ECFieldElement Sqrt()
         {
-            throw new ArithmeticException("Not implemented");
+            LongArray root = this.x;
+            if (root.IsOne() || root.IsZero())
+                return this;
+
+            for (int i = 1; i < m; ++i)
+            {
+                root = root.ModSquare(m, ks);
+            }
+            return new F2mFieldElement(m, ks, root);
         }
 
         /**