mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 02:31:44 +03:00
23 lines
608 B
Plaintext
23 lines
608 B
Plaintext
circuit PedersenHash {
|
|
parameters: u32[512]
|
|
static function new(parameters: u32[512]) -> Self {
|
|
return Self { parameters: parameters }
|
|
}
|
|
function hash(bits: bool[512]) -> u32 {
|
|
let mut digest: u32 = 0;
|
|
for i in 0..512 {
|
|
let base = if bits[i] ? parameters[i] : 0u32;
|
|
digest += base;
|
|
}
|
|
return digest
|
|
}
|
|
}
|
|
|
|
// The 'pedersen_hash' main function.
|
|
function main() -> u32 {
|
|
let parameters = [0u32; 512];
|
|
let pedersen = PedersenHash::new(parameters);
|
|
let input: bool[512] = [true; 512];
|
|
return pedersen.hash(input)
|
|
}
|