@@ -21,52 +21,48 @@ pub fn main() !void {
2121
2222 // Profile individual WOTS operations
2323 std .debug .print ("--- Single WOTS Operation Profile ---\n " , .{});
24-
24+
2525 const wots_priv_start_ts = std .time .nanoTimestamp ();
2626 const priv_key = try sig_scheme .wots .generatePrivateKey (allocator , & seed , 0 );
2727 const wots_priv_end_ts = std .time .nanoTimestamp ();
28-
28+
2929 const pub_key = try sig_scheme .wots .generatePublicKey (allocator , priv_key );
3030 const wots_pub_end_ts = std .time .nanoTimestamp ();
31-
31+
3232 const priv_time = @as (f64 , @floatFromInt (wots_priv_end_ts - wots_priv_start_ts )) / 1_000_000.0 ;
3333 const pub_time = @as (f64 , @floatFromInt (wots_pub_end_ts - wots_priv_end_ts )) / 1_000_000.0 ;
34-
34+
3535 std .debug .print (" generatePrivateKey: {d:.3} ms\n " , .{priv_time });
3636 std .debug .print (" generatePublicKey: {d:.3} ms\n " , .{pub_time });
3737 std .debug .print (" Total per leaf: {d:.3} ms\n\n " , .{priv_time + pub_time });
38-
38+
3939 for (priv_key ) | k | allocator .free (k );
4040 allocator .free (priv_key );
4141 allocator .free (pub_key );
4242
4343 // Profile hash operations
4444 std .debug .print ("--- Hash Operation Profile ---\n " , .{});
4545 const test_data = "test data for hashing" ;
46-
46+
4747 const hash_start_ts = std .time .nanoTimestamp ();
4848 const hash_result = try sig_scheme .wots .hash .hash (allocator , test_data , 0 );
4949 const hash_end_ts = std .time .nanoTimestamp ();
5050 allocator .free (hash_result );
51-
51+
5252 const hash_time = @as (f64 , @floatFromInt (hash_end_ts - hash_start_ts )) / 1_000_000.0 ;
5353 std .debug .print (" Single hash call: {d:.3} ms\n\n " , .{hash_time });
5454
5555 // Calculate expected times
5656 const num_leaves = @as (usize , 1 ) << @intCast (params .tree_height );
5757 const chain_length = @as (u32 , 1 ) << @intCast (@ctz (params .winternitz_w ));
58-
58+
5959 std .debug .print ("--- Theoretical Breakdown for 1,024 leaves ---\n " , .{});
6060 std .debug .print (" Chain length: {}\n " , .{chain_length });
6161 std .debug .print (" Chains per leaf: ~86\n " , .{});
6262 std .debug .print (" Hashes per leaf: ~86 * {} = ~{}\n " , .{ chain_length , 86 * chain_length });
6363 std .debug .print (" Total hashes: 1024 * {} = ~{}\n " , .{ 86 * chain_length , 1024 * 86 * chain_length });
64- std .debug .print (" Expected hash time: {d:.1} seconds\n " , .{
65- @as (f64 , @floatFromInt (1024 * 86 * chain_length )) * hash_time / 1000.0
66- });
67- std .debug .print (" Expected leaf gen: {d:.1} seconds\n\n " , .{
68- @as (f64 , @floatFromInt (num_leaves )) * (priv_time + pub_time ) / 1000.0
69- });
64+ std .debug .print (" Expected hash time: {d:.1} seconds\n " , .{@as (f64 , @floatFromInt (1024 * 86 * chain_length )) * hash_time / 1000.0 });
65+ std .debug .print (" Expected leaf gen: {d:.1} seconds\n\n " , .{@as (f64 , @floatFromInt (num_leaves )) * (priv_time + pub_time ) / 1000.0 });
7066
7167 // Now do full keygen with timing
7268 std .debug .print ("--- Full Key Generation ---\n " , .{});
@@ -85,4 +81,3 @@ pub fn main() !void {
8581 std .debug .print (" Merkle tree: ~{d:.1}%\n " , .{100.0 - leaf_gen_percent });
8682 std .debug .print (" Other overhead: ~{d:.1}%\n " , .{@max (0.0 , 100.0 - leaf_gen_percent - 10.0 )});
8783}
88-
0 commit comments