diff options
Diffstat (limited to 'poc/spike5_node.py')
| -rw-r--r-- | poc/spike5_node.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/poc/spike5_node.py b/poc/spike5_node.py index 6104e00..b560dc1 100644 --- a/poc/spike5_node.py +++ b/poc/spike5_node.py @@ -14,13 +14,19 @@ Note: node initiates the TCP connection (reversed for POC — in production, the QUIC client connects to the node using the hole-punching from Spike 4). """ -import asyncio, json, base64, struct, os, time +import asyncio +import base64 +import json +import os +import struct +import time from pathlib import Path + +import blake3 +from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305 from cryptography.hazmat.primitives.kdf.hkdf import HKDF -from cryptography.hazmat.primitives import hashes, serialization -import blake3 MESHBAY_HOST = "meshbay.org" MESHBAY_PORT = 19003 @@ -125,7 +131,7 @@ async def main(): print(f" {PASS} Test file: {TEST_FILE} ({file_size/1024/1024:.1f} MB)") # Pre-compute file hash (used in HKDF info string — identifies the file) - print(f" Computing file hash...") + print(" Computing file hash...") t0 = time.perf_counter() file_hash = blake3.blake3(TEST_FILE.read_bytes()).digest() print(f" {PASS} File hash: {file_hash.hex()[:16]}... ({(time.perf_counter()-t0)*1000:.0f}ms)") @@ -166,7 +172,7 @@ async def main(): print(f" {PASS} Sent {payload_kb:.1f} KB in {send_ms:.0f}ms ({throughput:.1f} MB/s)") print(f"\n {'='*50}") - print(f" Timings (node side):") + print(" Timings (node side):") print(f" Encrypt + sign : {enc_ms:.1f} ms") print(f" TCP send : {send_ms:.0f} ms") print(f" Total : {total_ms:.0f} ms") |