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 ;
6
2
7
3
namespace Org . BouncyCastle . Pqc . Crypto . Picnic
8
4
{
9
5
abstract internal class LowmcConstants
10
6
{
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
-
55
7
internal uint [ ] linearMatrices ;
56
8
internal uint [ ] roundConstants ;
57
9
internal uint [ ] keyMatrices ;
@@ -71,16 +23,11 @@ abstract internal class LowmcConstants
71
23
internal KMatrices KMatrix_full ;
72
24
internal KMatrices KMatrix_inv ;
73
25
internal KMatrices RConstants_full ;
74
-
75
- internal static uint [ ] ReadFromProperty ( string s , int intSize )
26
+
27
+ internal static uint [ ] ReadFromProperty ( uint [ ] data , int intSize )
76
28
{
77
- byte [ ] bytes = Hex . Decode ( s ) ;
78
29
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 ) ;
84
31
return ints ;
85
32
}
86
33
0 commit comments