Expand description
§ja4
A high-performance, production-ready, #![no_std] Rust implementation of the JA4 TLS fingerprinting algorithm.
JA4 is a standard for TLS client fingerprinting, providing a modular and human-readable representation of client hello characteristics. Unlike JA3, JA4 is designed to normalize GREASE values, sort extensions, and present the output in three distinct, readable sections:
- a: Connection details (Protocol, TLS version, SNI presence, Cipher count, Extension count, ALPN)
- b: A truncated hash of the sorted list of cipher suites
- c: A truncated hash of the sorted list of extensions and signature algorithms
§Example
use ja4::parse_ja4;
// Raw TLS ClientHello packet bytes (including TLS record header)
let client_hello_packet: &[u8] = &[
0x16, 0x03, 0x01, 0x00, 0x2d, // TLS Record Header (Handshake, TLS 1.0, 45 bytes)
0x01, 0x00, 0x00, 0x29, // Handshake Header (ClientHello, 41 bytes)
0x03, 0x03, // Client Version (TLS 1.2)
// ... remaining packet bytes ...
];
// Parse TCP-based TLS ClientHello packet
if let Some(result) = parse_ja4(client_hello_packet, false) {
println!("JA4 Fingerprint: {}", result);
}Structs§
- Ja4Result
- The result of a successfully parsed and calculated JA4 TLS fingerprint.
Functions§
- parse_
ja4 - Parses a raw TLS ClientHello packet (including the 5-byte TLS record header for TCP) and calculates the JA4 fingerprint.