summary refs log tree commit diff
path: root/crypto/src/crypto/engines/GOST28147Engine.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2018-04-08 22:00:07 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2018-04-08 22:00:07 +0700
commita99cc87c318851a4bc717c55f8fb97b8e1ca1416 (patch)
treef5d5b7965187371fa695fb5dc4760571537dd26c /crypto/src/crypto/engines/GOST28147Engine.cs
parentUpdate registries for digests, MACs from bc-java (diff)
downloadBouncyCastle.NET-ed25519-a99cc87c318851a4bc717c55f8fb97b8e1ca1416.tar.xz
Added method for looking up name of SBox.
Diffstat (limited to '')
-rw-r--r--crypto/src/crypto/engines/GOST28147Engine.cs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crypto/src/crypto/engines/GOST28147Engine.cs b/crypto/src/crypto/engines/GOST28147Engine.cs
index 71e6d9e44..acf0be27b 100644
--- a/crypto/src/crypto/engines/GOST28147Engine.cs
+++ b/crypto/src/crypto/engines/GOST28147Engine.cs
@@ -364,5 +364,19 @@ namespace Org.BouncyCastle.Crypto.Engines
 
 			return Arrays.Clone(sBox);
 		}
-	}
+
+        public static string GetSBoxName(byte[] sBox)
+        {
+            foreach (string name in sBoxes.Keys)
+            {
+                byte[] sb = (byte[])sBoxes[name];
+                if (Arrays.AreEqual(sb, sBox))
+                {
+                    return name;
+                }
+            }
+
+            throw new ArgumentException("SBOX provided did not map to a known one");
+        }
+    }
 }