leo/grammar/benches/main.leo

27 lines
688 B
Plaintext
Raw Normal View History

circuit PedersenHash {
parameters: [group; 256],
// Instantiates a Pedersen hash circuit
static function new(parameters: [group; 256]) -> Self {
return Self { parameters: parameters }
}
function hash(bits: [bool; 256]) -> group {
let mut digest: group = 0;
for i in 0..256 {
if bits[i] {
digest += self.parameters[i];
}
}
return digest
}
}
// The 'pedersen-hash' main function.
function main() -> group {
const parameters = [1group; 256];
const pedersen = PedersenHash::new(parameters);
let hash_input: [bool; 256] = [true; 256];
return pedersen.hash(hash_input)
2020-08-03 06:33:05 +03:00
}