could you, please, help with bouncycastle for hash function GOST 34.311. Somehow results are diffferent from test vector. Wiki says: "GOST("The quick brown fox jumps over the lazy dog") = 77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294"
when using Digest Gost 34.11:
var testString = "The quick brown fox jumps over the lazy dog";
var result = (new GOST3411.Digest()).digest(testString.getBytes());
var resHex2 = new BigInteger(1, result).toString(16);
assertEquals("77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294", resHex2.toUpperCase());
got:
org.opentest4j.AssertionFailedError:
Expected :77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294
Actual :9004294A361A508C586FE53D1F1B02746765E71B765472786E4770D565830A76
with 2012 version:
var testString = "The quick brown fox jumps over the lazy dog";
var result = (new GOST3411.Digest2012_256()).digest(testString.getBytes());
var resHex2 = new BigInteger(1, result).toString(16);
assertEquals("77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294", resHex2.toUpperCase());
got :
AssertionFailedError:
Expected :77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294
Actual :3E7DEA7F2384B6C5A3D0E24AAA29C05E89DDD762145030EC22C71A6DB8B2C1F4
Does BouncyCastle support origin GOST 34.311 - 95? What is correct way to calculate it?
BC is using the
GOST R 34.11-2012
(streebog) version of the standardThe wikipedia samples are for the deprecated
GOST R 34.11-94
versionIf you actually want the old one, you should probably ask for plain
GOST3411Digest
instead ofGOST3411.Digest2012_256
which is the new one.