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
79fc2f9d
Commit
79fc2f9d
authored
Nov 05, 2021
by
Roman Walch
Browse files
add rc bounty instances
parent
ef447fe5
Changes
40
Hide whitespace changes
Inline
Side-by-side
bounties/Cargo.toml
View file @
79fc2f9d
...
...
@@ -9,7 +9,6 @@ edition = "2018"
ff
=
{
package
=
"ff_ce"
,
version
=
"0.13"
,
features
=
["derive"]
}
rand
=
"0.4"
# held back for ff_ce
lazy_static
=
"1.4"
cfg-if
=
"1.0"
sha3
=
"0.9"
[[example]]
...
...
@@ -72,6 +71,18 @@ path = "examples/feistel_mimc/feistel_mimc_hard1.rs"
name
=
"feistel_mimc_hard2"
path
=
"examples/feistel_mimc/feistel_mimc_hard2.rs"
[[example]]
name
=
"reinforced_concrete_easy"
path
=
"examples/reinforced_concrete/reinforced_concrete_easy.rs"
[[example]]
name
=
"reinforced_concrete_medium"
path
=
"examples/reinforced_concrete/reinforced_concrete_medium.rs"
[[example]]
name
=
"reinforced_concrete_hard"
path
=
"examples/reinforced_concrete/reinforced_concrete_hard.rs"
[profile.release]
lto
=
true
codegen-units
=
1
...
...
bounties/examples/feistel_mimc/feistel_mimc_easy1.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
feistel_mimc
::{
feistel_mimc
::
FeistelMimc
,
feistel_mimc_instances
::
FM_PARAMS_EASY1
},
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/feistel_mimc/feistel_mimc_easy2.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
feistel_mimc
::{
feistel_mimc
::
FeistelMimc
,
feistel_mimc_instances
::
FM_PARAMS_EASY2
},
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/feistel_mimc/feistel_mimc_hard1.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
feistel_mimc
::{
feistel_mimc
::
FeistelMimc
,
feistel_mimc_instances
::
FM_PARAMS_HARD1
},
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/feistel_mimc/feistel_mimc_hard2.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
feistel_mimc
::{
feistel_mimc
::
FeistelMimc
,
feistel_mimc_instances
::
FM_PARAMS_HARD2
},
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/feistel_mimc/feistel_mimc_medium.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
feistel_mimc
::{
feistel_mimc
::
FeistelMimc
,
feistel_mimc_instances
::
FM_PARAMS_MEDIUM
},
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/poseidon/poseidon_easy1.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
poseidon
::{
poseidon
::
Poseidon
,
poseidon_instances
::
POSEIDON_PARAMS_EASY1
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/poseidon/poseidon_easy2.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
poseidon
::{
poseidon
::
Poseidon
,
poseidon_instances
::
POSEIDON_PARAMS_EASY2
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/poseidon/poseidon_hard1.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
poseidon
::{
poseidon
::
Poseidon
,
poseidon_instances
::
POSEIDON_PARAMS_HARD1
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/poseidon/poseidon_hard2.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
poseidon
::{
poseidon
::
Poseidon
,
poseidon_instances
::
POSEIDON_PARAMS_HARD2
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/poseidon/poseidon_medium.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
poseidon
::{
poseidon
::
Poseidon
,
poseidon_instances
::
POSEIDON_PARAMS_MEDIUM
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/reinforced_concrete/reinforced_concrete_easy.rs
0 → 100644
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field48
::
Fp48
,
utils
},
reinforced_concrete
::{
reinforced_concrete
::
ReinforcedConcrete
,
reinforced_concrete_instances
::
RC_PARAMS_EASY
,
},
};
type
Scalar
=
Fp48
;
static
RANDOM_INPUT
:
bool
=
false
;
fn
main
()
{
let
params
=
&
RC_PARAMS_EASY
;
let
rc
=
ReinforcedConcrete
::
new
(
params
);
println!
(
"Reinforced Concrete Challange easy"
);
// insert your solution here:
let
solution1
:
Scalar
=
from_hex
(
"0x0000000000000000"
)
.unwrap
();
let
solution2
:
Scalar
=
from_hex
(
"0x0000000000000000"
)
.unwrap
();
let
input
=
if
RANDOM_INPUT
{
[
utils
::
random_scalar
(
true
),
utils
::
random_scalar
(
true
),
Scalar
::
zero
(),
]
}
else
{
[
solution1
,
solution2
,
Scalar
::
zero
()]
};
let
output
=
rc
.permutation
(
&
input
);
println!
(
"Input = {:?}"
,
input
);
println!
(
"Output = {:?}"
,
output
);
if
output
[
output
.len
()
-
1
]
==
Scalar
::
zero
()
{
println!
(
"Challenge solved!"
);
}
else
{
println!
(
"Challenge not solved!"
);
}
}
bounties/examples/reinforced_concrete/reinforced_concrete_hard.rs
0 → 100644
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field64
::
Fp64
,
utils
},
reinforced_concrete
::{
reinforced_concrete
::
ReinforcedConcrete
,
reinforced_concrete_instances
::
RC_PARAMS_HARD
,
},
};
type
Scalar
=
Fp64
;
static
RANDOM_INPUT
:
bool
=
false
;
fn
main
()
{
let
params
=
&
RC_PARAMS_HARD
;
let
rc
=
ReinforcedConcrete
::
new
(
params
);
println!
(
"Reinforced Concrete Challange hard"
);
// insert your solution here:
let
solution1
:
Scalar
=
from_hex
(
"0x0000000000000000"
)
.unwrap
();
let
solution2
:
Scalar
=
from_hex
(
"0x0000000000000000"
)
.unwrap
();
let
input
=
if
RANDOM_INPUT
{
[
utils
::
random_scalar
(
true
),
utils
::
random_scalar
(
true
),
Scalar
::
zero
(),
]
}
else
{
[
solution1
,
solution2
,
Scalar
::
zero
()]
};
let
output
=
rc
.permutation
(
&
input
);
println!
(
"Input = {:?}"
,
input
);
println!
(
"Output = {:?}"
,
output
);
if
output
[
output
.len
()
-
1
]
==
Scalar
::
zero
()
{
println!
(
"Challenge solved!"
);
}
else
{
println!
(
"Challenge not solved!"
);
}
}
bounties/examples/reinforced_concrete/reinforced_concrete_medium.rs
0 → 100644
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field56
::
Fp56
,
utils
},
reinforced_concrete
::{
reinforced_concrete
::
ReinforcedConcrete
,
reinforced_concrete_instances
::
RC_PARAMS_MEDIUM
,
},
};
type
Scalar
=
Fp56
;
static
RANDOM_INPUT
:
bool
=
false
;
fn
main
()
{
let
params
=
&
RC_PARAMS_MEDIUM
;
let
rc
=
ReinforcedConcrete
::
new
(
params
);
println!
(
"Reinforced Concrete Challange medium"
);
// insert your solution here:
let
solution1
:
Scalar
=
from_hex
(
"0x0000000000000000"
)
.unwrap
();
let
solution2
:
Scalar
=
from_hex
(
"0x0000000000000000"
)
.unwrap
();
let
input
=
if
RANDOM_INPUT
{
[
utils
::
random_scalar
(
true
),
utils
::
random_scalar
(
true
),
Scalar
::
zero
(),
]
}
else
{
[
solution1
,
solution2
,
Scalar
::
zero
()]
};
let
output
=
rc
.permutation
(
&
input
);
println!
(
"Input = {:?}"
,
input
);
println!
(
"Output = {:?}"
,
output
);
if
output
[
output
.len
()
-
1
]
==
Scalar
::
zero
()
{
println!
(
"Challenge solved!"
);
}
else
{
println!
(
"Challenge not solved!"
);
}
}
bounties/examples/rescue/rescue_easy1.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
rescue_prime
::{
rescue_prime
::
RescuePrime
,
rescue_prime_instances
::
RESCUE_PRIME_PARAMS_EASY1
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/rescue/rescue_easy2.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
rescue_prime
::{
rescue_prime
::
RescuePrime
,
rescue_prime_instances
::
RESCUE_PRIME_PARAMS_EASY2
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/rescue/rescue_hard1.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
rescue_prime
::{
rescue_prime
::
RescuePrime
,
rescue_prime_instances
::
RESCUE_PRIME_PARAMS_HARD1
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/rescue/rescue_hard2.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
rescue_prime
::{
rescue_prime
::
RescuePrime
,
rescue_prime_instances
::
RESCUE_PRIME_PARAMS_HARD2
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/examples/rescue/rescue_medium.rs
View file @
79fc2f9d
use
ff
::{
from_hex
,
Field
};
use
zkhash_bounties
::{
fields
::{
field
::
Fp
,
utils
},
fields
::{
field
64
::
Fp
64
,
utils
},
rescue_prime
::{
rescue_prime
::
RescuePrime
,
rescue_prime_instances
::
RESCUE_PRIME_PARAMS_MEDIUM
},
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
static
RANDOM_INPUT
:
bool
=
false
;
...
...
bounties/src/feistel_mimc/feistel_mimc.rs
View file @
79fc2f9d
...
...
@@ -57,11 +57,11 @@ mod feistel_mimc_kats {
use
super
::
*
;
use
crate
::
feistel_mimc
::
feistel_mimc_instances
::
*
;
use
crate
::
fields
::
field
::
Fp
;
use
crate
::
fields
::
field
64
::
Fp
64
;
use
ff
::{
from_hex
,
Field
};
type
Scalar
=
Fp
;
type
Scalar
=
Fp
64
;
#[test]
fn
easy1_kats
()
{
...
...
Prev
1
2
Next
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