adding goldilocks to stark fields - doesn't work yet

This commit is contained in:
dana
2024-07-30 18:54:29 +03:00
parent 2a3dcd776a
commit 5fbe60f44e
4 changed files with 38 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
function(check_field)
set(SUPPORTED_FIELDS babybear;stark252)
# set(SUPPORTED_FIELDS babybear;stark252)
set(SUPPORTED_FIELDS babybear;stark252;m31;goldilocks)# m31 is not implemented yet
set(IS_FIELD_SUPPORTED FALSE)
set(I 1000)

View File

@@ -31,4 +31,7 @@ namespace field_config = babybear;
#elif FIELD_ID == STARK_252
#include "icicle/fields/stark_fields/stark252.h"
namespace field_config = stark252;
#elif FIELD_ID == GOLDILOCKS
#include "icicle/fields/stark_fields/goldilocks.h"
namespace field_config = goldilocks;
#endif

View File

@@ -10,5 +10,7 @@
#define BABY_BEAR 1001
#define STARK_252 1002
#define M31 1003 // m31 is not implemented yet
#define GOLDILOCKS 1004
#endif

View File

@@ -0,0 +1,30 @@
#pragma once
#include "icicle/fields/storage.h"
#include "icicle/fields/field.h"
#include "icicle/fields/params_gen.h"
// modulus = 18446744069414584321 (2^64 - 2^32 + 1)(0xFFFFFFFF00000001)
// rou = 2717 (0x00000A9D)
namespace goldilocks {
struct fp_config {
// static constexpr storage<8> modulus = {0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000011, 0x08000000};//stark252
// static constexpr storage<1> modulus = {0x78000001};//babybear
// static constexpr storage<2> modulus = {0x00000001, 0xffffffff};//goldilocks
// static constexpr storage<2> modulus = {0x00000001, 0xffffffff};//games
static constexpr storage<2> modulus = {0x00000001, 0xffffffff};//games
PARAMS(modulus)
// static constexpr storage<8> rou = {0x42f8ef94, 0x6070024f, 0xe11a6161, 0xad187148, 0x9c8b0fa5, 0x3f046451, 0x87529cfa, 0x005282db};//stark252
// static constexpr storage<1> rou = {0x00000089};//babybear
static constexpr storage<1> rou = {0x00000a9d};//goldilocks
TWIDDLES(modulus, rou)
};
/**
* Scalar field. Is always a prime field.
*/
typedef Field<fp_config> scalar_t;
} // namespace goldilocks