MCPcopy Index your code
hub / github.com/RustPython/RustPython / generate_session_id_from_metadata

Function generate_session_id_from_metadata

crates/stdlib/src/ssl.rs:437–447  ·  view source on GitHub ↗

Generate a synthetic session ID from server name and timestamp NOTE: This is NOT the actual TLS session ID, just a unique identifier

(server_name: &str, time: &SystemTime)

Source from the content-addressed store, hash-verified

435 // Generate a synthetic session ID from server name and timestamp
436 // NOTE: This is NOT the actual TLS session ID, just a unique identifier
437 fn generate_session_id_from_metadata(server_name: &str, time: &SystemTime) -> Vec<u8> {
438 let mut hasher = Sha256::new();
439 hasher.update(server_name.as_bytes());
440 hasher.update(
441 time.duration_since(SystemTime::UNIX_EPOCH)
442 .unwrap()
443 .as_secs()
444 .to_le_bytes(),
445 );
446 hasher.finalize()[..16].to_vec()
447 }
448
449 // Custom ClientSessionStore that tracks session metadata for Python access
450 // NOTE: This wraps ClientSessionMemoryCache and records metadata when sessions are stored

Callers 3

set_tls12_sessionMethod · 0.85
insert_tls13_ticketMethod · 0.85

Calls 6

newFunction · 0.85
to_vecMethod · 0.80
updateMethod · 0.45
as_bytesMethod · 0.45
unwrapMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected