Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 4 additions & 57 deletions crypto/src/pqc/crypto/picnic/LowmcConstants.cs
Original file line number Diff line number Diff line change
@@ -1,57 +1,9 @@
using System.Collections.Generic;
using System.IO;

using Org.BouncyCastle.Crypto.Utilities;
using Org.BouncyCastle.Utilities.Encoders;
using System;

namespace Org.BouncyCastle.Pqc.Crypto.Picnic
{
abstract internal class LowmcConstants
{
internal Dictionary<string, string> _matrixToHex;

// private ()
// private LowmcConstants()
// {
// _matrixToHex = new Dictionary<string, string>();
// Stream input = typeof(LowmcConstants).Assembly
// .GetManifestResourceStream("Org.BouncyCastle.pqc.crypto.picnic.lowmcconstants.properties");
//
// using (StreamReader sr = new StreamReader(input))
// {
// // load a properties file
// string line = sr.ReadLine();
// string matrix, hexString;
//
// while (line != null)
// {
// string header = line;
// if (header != "")
// {
// header = header.Replace(",", "");
// int index = header.IndexOf('=');
// matrix = header.Substring(0, index).Trim();
// hexString = header.Substring(index + 1).Trim();
// _matrixToHex.Add(matrix, hexString);
// }
//
// line = sr.ReadLine();
// }
// }
//



// }
//
// internal static LowmcConstants Instance
// {
// get { return instance; }
// }

// private static Dictionary<string, string> _matrixToHex;


internal uint[] linearMatrices;
internal uint[] roundConstants;
internal uint[] keyMatrices;
Expand All @@ -71,16 +23,11 @@ abstract internal class LowmcConstants
internal KMatrices KMatrix_full;
internal KMatrices KMatrix_inv;
internal KMatrices RConstants_full;
internal static uint[] ReadFromProperty(string s, int intSize)

internal static uint[] ReadFromProperty(uint[] data, int intSize)
{
byte[] bytes = Hex.Decode(s);
uint[] ints = new uint[intSize];
for (int i = 0; i < bytes.Length/4; i++)
{
ints[i] = Pack.LE_To_UInt32(bytes, i*4);
}

Array.Copy(data, ints, data.Length);
return ints;
}

Expand Down
3,852 changes: 3,815 additions & 37 deletions crypto/src/pqc/crypto/picnic/LowmcConstantsL1.cs

Large diffs are not rendered by default.

10,911 changes: 10,874 additions & 37 deletions crypto/src/pqc/crypto/picnic/LowmcConstantsL3.cs

Large diffs are not rendered by default.

23,411 changes: 23,372 additions & 39 deletions crypto/src/pqc/crypto/picnic/LowmcConstantsL5.cs

Large diffs are not rendered by default.

Binary file removed crypto/src/pqc/crypto/picnic/lowmcL1.bz2
Binary file not shown.
Binary file removed crypto/src/pqc/crypto/picnic/lowmcL3.bz2
Binary file not shown.
Binary file removed crypto/src/pqc/crypto/picnic/lowmcL5.bz2
Binary file not shown.