1- using System . Collections . Generic ;
2- using System . IO ;
3-
4- using Org . BouncyCastle . Crypto . Utilities ;
5- using Org . BouncyCastle . Utilities . Encoders ;
1+ using System ;
62
73namespace Org . BouncyCastle . Pqc . Crypto . Picnic
84{
95 abstract internal class LowmcConstants
106 {
11- internal Dictionary < string , string > _matrixToHex ;
12-
13- // private ()
14- // private LowmcConstants()
15- // {
16- // _matrixToHex = new Dictionary<string, string>();
17- // Stream input = typeof(LowmcConstants).Assembly
18- // .GetManifestResourceStream("Org.BouncyCastle.pqc.crypto.picnic.lowmcconstants.properties");
19- //
20- // using (StreamReader sr = new StreamReader(input))
21- // {
22- // // load a properties file
23- // string line = sr.ReadLine();
24- // string matrix, hexString;
25- //
26- // while (line != null)
27- // {
28- // string header = line;
29- // if (header != "")
30- // {
31- // header = header.Replace(",", "");
32- // int index = header.IndexOf('=');
33- // matrix = header.Substring(0, index).Trim();
34- // hexString = header.Substring(index + 1).Trim();
35- // _matrixToHex.Add(matrix, hexString);
36- // }
37- //
38- // line = sr.ReadLine();
39- // }
40- // }
41- //
42-
43-
44-
45- // }
46- //
47- // internal static LowmcConstants Instance
48- // {
49- // get { return instance; }
50- // }
51-
52- // private static Dictionary<string, string> _matrixToHex;
53-
54-
557 internal uint [ ] linearMatrices ;
568 internal uint [ ] roundConstants ;
579 internal uint [ ] keyMatrices ;
@@ -71,16 +23,11 @@ abstract internal class LowmcConstants
7123 internal KMatrices KMatrix_full ;
7224 internal KMatrices KMatrix_inv ;
7325 internal KMatrices RConstants_full ;
74-
75- internal static uint [ ] ReadFromProperty ( string s , int intSize )
26+
27+ internal static uint [ ] ReadFromProperty ( uint [ ] data , int intSize )
7628 {
77- byte [ ] bytes = Hex . Decode ( s ) ;
7829 uint [ ] ints = new uint [ intSize ] ;
79- for ( int i = 0 ; i < bytes . Length / 4 ; i ++ )
80- {
81- ints [ i ] = Pack . LE_To_UInt32 ( bytes , i * 4 ) ;
82- }
83-
30+ Array . Copy ( data , ints , data . Length ) ;
8431 return ints ;
8532 }
8633
0 commit comments