diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-04-08 22:00:07 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-04-08 22:00:07 +0700 |
commit | a99cc87c318851a4bc717c55f8fb97b8e1ca1416 (patch) | |
tree | f5d5b7965187371fa695fb5dc4760571537dd26c /crypto/src/crypto/engines/GOST28147Engine.cs | |
parent | Update registries for digests, MACs from bc-java (diff) | |
download | BouncyCastle.NET-ed25519-a99cc87c318851a4bc717c55f8fb97b8e1ca1416.tar.xz |
Added method for looking up name of SBox.
Diffstat (limited to '')
-rw-r--r-- | crypto/src/crypto/engines/GOST28147Engine.cs | 16 |
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"); + } + } } |