mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-10 01:33:07 +00:00
Blake progress
This commit is contained in:
parent
ebd606621f
commit
9774b74b90
@ -216,4 +216,5 @@ compression_loop:
|
||||
%blake_generate_new_hash_value(1)
|
||||
%blake_generate_new_hash_value(0)
|
||||
// stack: h_0', h_1', h_2', h_3', h_4', h_5', h_6', h_7', retdest
|
||||
STOP
|
||||
%stack (hash: 8, retdest) -> (retdest, hash)
|
||||
JUMP
|
||||
@ -59,38 +59,36 @@ fn make_input_stack(message: Vec<u8>) -> Vec<U256> {
|
||||
fn test_hash(hash_fn_label: &str, standard_implementation: &dyn Fn(Vec<u8>) -> U256) -> Result<()> {
|
||||
// Make the input.
|
||||
let message_random = make_random_input();
|
||||
// let message_custom = make_custom_input();
|
||||
let message_custom = make_custom_input();
|
||||
|
||||
dbg!(message_random.clone());
|
||||
|
||||
// Hash the message using a standard implementation.
|
||||
// let expected_random = standard_implementation(message_random.clone());
|
||||
// let expected_custom = standard_implementation(message_custom.clone());
|
||||
let expected_random = standard_implementation(message_random.clone());
|
||||
let expected_custom = standard_implementation(message_custom.clone());
|
||||
|
||||
// Load the message onto the stack.
|
||||
let initial_stack_random = make_input_stack(message_random);
|
||||
// let initial_stack_custom = make_input_stack(message_custom);
|
||||
let initial_stack_custom = make_input_stack(message_custom);
|
||||
|
||||
dbg!(initial_stack_random.clone());
|
||||
|
||||
// Make the kernel.
|
||||
let kernel_function = KERNEL.global_labels[hash_fn_label];
|
||||
|
||||
dbg!("HERE");
|
||||
|
||||
// Run the kernel code.
|
||||
let result_random = run_interpreter(kernel_function, initial_stack_random)?;
|
||||
// let result_custom = run_interpreter(kernel_function, initial_stack_custom)?;
|
||||
let result_custom = run_interpreter(kernel_function, initial_stack_custom)?;
|
||||
|
||||
dbg!(result_random.stack());
|
||||
|
||||
// Extract the final output.
|
||||
let actual_random = result_random.stack()[0];
|
||||
// let actual_custom = result_custom.stack()[0];
|
||||
let actual_custom = result_custom.stack()[0];
|
||||
|
||||
// Check that the result is correct.
|
||||
// assert_eq!(expected_random, actual_random);
|
||||
// assert_eq!(expected_custom, actual_custom);
|
||||
assert_eq!(expected_custom, actual_custom);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user