mirror of
https://github.com/AleoHQ/leo.git
synced 2024-09-21 12:07:56 +03:00
update pedersen hash example to use constant inputs
This commit is contained in:
parent
b5ae4e1ca4
commit
ae9ba51b7d
@ -60,7 +60,7 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
|||||||
)?)),
|
)?)),
|
||||||
Type::Array(type_, len) => self.allocate_array(cs, name, &*type_, *len, input_option, span),
|
Type::Array(type_, len) => self.allocate_array(cs, name, &*type_, *len, input_option, span),
|
||||||
Type::Tuple(types) => self.allocate_tuple(cs, &name, types, input_option, span),
|
Type::Tuple(types) => self.allocate_tuple(cs, &name, types, input_option, span),
|
||||||
_ => unimplemented!("main function input not implemented for type {}", type_),
|
_ => unimplemented!("main function input not implemented for type {}", type_), // Todo @damirka: add an error for this case
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
[main]
|
[main]
|
||||||
|
hash_input: [bool; 256] = [true; 256];
|
||||||
|
|
||||||
|
[constants]
|
||||||
|
parameters: [group; 256] = [1group; 256];
|
||||||
|
|
||||||
[registers]
|
[registers]
|
||||||
r0: group = (1, 0)group;
|
r0: group = (1, 0)group;
|
@ -18,10 +18,10 @@ circuit PedersenHash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The 'pedersen-hash' main function.
|
// The 'pedersen-hash' main function.
|
||||||
function main() -> group {
|
function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group {
|
||||||
let parameters = [1group; 256];
|
|
||||||
let pedersen = PedersenHash::new(parameters);
|
let pedersen = PedersenHash::new(parameters);
|
||||||
let hash_input: [bool; 256] = [true; 256];
|
let output = pedersen.hash(hash_input);
|
||||||
return pedersen.hash(hash_input)
|
console.log("{}", output);
|
||||||
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user