Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
krypto
ZKFriendlyHashZoo
Commits
e69d08f6
Commit
e69d08f6
authored
Dec 20, 2021
by
Roman Walch
Browse files
update the feistel-mimc instances
parent
79fc2f9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
bounties/src/feistel_mimc/feistel_mimc.rs
View file @
e69d08f6
...
...
@@ -68,8 +68,8 @@ mod feistel_mimc_kats {
let
fm
=
FeistelMimc
::
new
(
&
FM_PARAMS_EASY1
);
let
input
:
[
Scalar
;
2
]
=
[
Scalar
::
zero
(),
Scalar
::
one
()];
let
perm
=
fm
.permutation
(
&
input
);
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
45b9c3d2a4bbdc9e
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0
0ddd29700b3a6bc76
"
)
.unwrap
());
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
f874e35bbaf92376
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0
x72af6f65901ac3f1
"
)
.unwrap
());
}
#[test]
...
...
@@ -77,8 +77,8 @@ mod feistel_mimc_kats {
let
fm
=
FeistelMimc
::
new
(
&
FM_PARAMS_EASY2
);
let
input
:
[
Scalar
;
2
]
=
[
Scalar
::
zero
(),
Scalar
::
one
()];
let
perm
=
fm
.permutation
(
&
input
);
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
788a3f6ea5a6a53e
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0x
25222a199c56f899
"
)
.unwrap
());
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
85bd8eb1f92bfb9a
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0x
49d9875c885a962c
"
)
.unwrap
());
}
#[test]
...
...
@@ -86,8 +86,8 @@ mod feistel_mimc_kats {
let
fm
=
FeistelMimc
::
new
(
&
FM_PARAMS_MEDIUM
);
let
input
:
[
Scalar
;
2
]
=
[
Scalar
::
zero
(),
Scalar
::
one
()];
let
perm
=
fm
.permutation
(
&
input
);
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
0bd74ec3122b04f6
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0x
67d7f4198480eaee
"
)
.unwrap
());
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
6f069da7d13eeac0
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0x
f99209102b0f4e3b
"
)
.unwrap
());
}
#[test]
...
...
@@ -95,8 +95,8 @@ mod feistel_mimc_kats {
let
fm
=
FeistelMimc
::
new
(
&
FM_PARAMS_HARD1
);
let
input
:
[
Scalar
;
2
]
=
[
Scalar
::
zero
(),
Scalar
::
one
()];
let
perm
=
fm
.permutation
(
&
input
);
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
299f5eaff8f41844
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0x
d7c9d66716f2cae7
"
)
.unwrap
());
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
1017818eae881aee
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0x
7e7025221ea192b6
"
)
.unwrap
());
}
#[test]
...
...
@@ -104,7 +104,7 @@ mod feistel_mimc_kats {
let
fm
=
FeistelMimc
::
new
(
&
FM_PARAMS_HARD2
);
let
input
:
[
Scalar
;
2
]
=
[
Scalar
::
zero
(),
Scalar
::
one
()];
let
perm
=
fm
.permutation
(
&
input
);
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
f874e35bbaf92376
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0x
72af6f65901ac3f1
"
)
.unwrap
());
assert_eq!
(
perm
[
0
],
from_hex
(
"0x
095c81195f93fa60
"
)
.unwrap
());
assert_eq!
(
perm
[
1
],
from_hex
(
"0x
41c45da5e1655eb6
"
)
.unwrap
());
}
}
bounties/src/feistel_mimc/feistel_mimc_instances.rs
View file @
e69d08f6
...
...
@@ -7,13 +7,13 @@ type Scalar = Fp64;
lazy_static!
{
pub
static
ref
FM_PARAMS_EASY1
:
Arc
<
FeistelMimcParams
<
Scalar
>>
=
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
6
));
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
22
));
pub
static
ref
FM_PARAMS_EASY2
:
Arc
<
FeistelMimcParams
<
Scalar
>>
=
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
10
));
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
25
));
pub
static
ref
FM_PARAMS_MEDIUM
:
Arc
<
FeistelMimcParams
<
Scalar
>>
=
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
14
));
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
30
));
pub
static
ref
FM_PARAMS_HARD1
:
Arc
<
FeistelMimcParams
<
Scalar
>>
=
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
18
));
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
35
));
pub
static
ref
FM_PARAMS_HARD2
:
Arc
<
FeistelMimcParams
<
Scalar
>>
=
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
22
));
Arc
::
new
(
FeistelMimcParams
::
new
(
3
,
40
));
}
bounties/src/poseidon/poseidon_params.rs
View file @
e69d08f6
...
...
@@ -6,6 +6,7 @@ pub struct PoseidonParams<S: PrimeField> {
pub
(
crate
)
d
:
usize
,
// sbox degree
pub
(
crate
)
rounds_f_beginning
:
usize
,
pub
(
crate
)
rounds_p
:
usize
,
#[allow(dead_code)]
pub
(
crate
)
rounds_f_end
:
usize
,
pub
(
crate
)
rounds
:
usize
,
pub
(
crate
)
mds
:
Vec
<
Vec
<
S
>>
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment