guise 0.1.2

Canonical browser fingerprint bundles, human-behavior timing, and TLS profile re-exports for the Santh fleet
Documentation
//! Chrome TLS and HTTP/2 fingerprint snapshots for diagnostics.
//!
//! These entries are used to compare an observed browser transport against
//! bundled Chrome handshake shapes. The catalogue is passive data: it does not
//! open network connections or alter TLS handshakes.

use serde::{Deserialize, Serialize};

/// One captured Chrome TLS and HTTP/2 fingerprint.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct ChromeFingerprint {
    /// Human-readable name, for example `"Chrome 134 / Linux"`.
    pub name: &'static str,
    /// Chrome major version.
    pub major_version: u32,
    /// Platform string used by diagnostics.
    pub platform: &'static str,
    /// JA3 string: TLS version, ciphers, extensions, groups, and EC point
    /// formats.
    pub ja3: &'static str,
    /// JA3 hash as a 32-character lowercase hex string.
    pub ja3_hash: &'static str,
    /// JA4 string.
    pub ja4: &'static str,
    /// HTTP/2 fingerprint in Akamai-style
    /// `settings|window_update|priority|headers` form.
    pub h2_fingerprint: &'static str,
}

/// Bundled Chrome TLS and HTTP/2 fingerprint snapshots.
///
/// Entries are ordered by diagnostic preference. The resolver returns an exact
/// major/platform match when present, then the highest bundled major on the
/// same platform, then the first entry as a final fallback.
pub const CHROME_FINGERPRINTS: &[ChromeFingerprint] = &[
    ChromeFingerprint {
        name: "Chrome 134 / Linux",
        major_version: 134,
        platform: "Linux",
        ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513-21,29-23-24,0",
        ja3_hash: "cd08e31494f9531f560d64c695473da9",
        ja4: "t13d1517h2_8daaf6152771_b0da82dd1658",
        h2_fingerprint: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
    },
    ChromeFingerprint {
        name: "Chrome 133 / Linux",
        major_version: 133,
        platform: "Linux",
        ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0",
        ja3_hash: "cd08e31494f9531f560d64c695473da9",
        ja4: "t13d1517h2_8daaf6152771_b0da82dd1658",
        h2_fingerprint: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
    },
    ChromeFingerprint {
        name: "Chrome 132 / Linux",
        major_version: 132,
        platform: "Linux",
        ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0",
        ja3_hash: "cd08e31494f9531f560d64c695473da9",
        ja4: "t13d1517h2_8daaf6152771_b0da82dd1658",
        h2_fingerprint: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
    },
    ChromeFingerprint {
        name: "Chrome 131 / Linux",
        major_version: 131,
        platform: "Linux",
        ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0",
        ja3_hash: "cd08e31494f9531f560d64c695473da9",
        ja4: "t13d1517h2_8daaf6152771_b0da82dd1658",
        h2_fingerprint: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
    },
    ChromeFingerprint {
        name: "Chrome 130 / Linux",
        major_version: 130,
        platform: "Linux",
        ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0",
        ja3_hash: "cd08e31494f9531f560d64c695473da9",
        ja4: "t13d1517h2_8daaf6152771_b0da82dd1658",
        h2_fingerprint: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
    },
    ChromeFingerprint {
        name: "Chrome 134 / macOS",
        major_version: 134,
        platform: "macOS",
        ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513-21,29-23-24,0",
        ja3_hash: "cd08e31494f9531f560d64c695473da9",
        ja4: "t13d1517h2_8daaf6152771_b0da82dd1658",
        h2_fingerprint: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
    },
    ChromeFingerprint {
        name: "Chrome 134 / Windows",
        major_version: 134,
        platform: "Windows",
        ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-17513-21,29-23-24,0",
        ja3_hash: "cd08e31494f9531f560d64c695473da9",
        ja4: "t13d1517h2_8daaf6152771_b0da82dd1658",
        h2_fingerprint: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
    },
    ChromeFingerprint {
        name: "Chrome 134 / Android",
        major_version: 134,
        platform: "Android",
        ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0",
        ja3_hash: "cd08e31494f9531f560d64c695473da9",
        ja4: "t13d1516h2_8daaf6152771_b0da82dd1658",
        h2_fingerprint: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
    },
];

/// Return the expected Chrome fingerprint for `major` and `platform`.
///
/// Resolution prefers an exact match, then the highest bundled major for the
/// same platform, then the first bundled entry.
#[must_use]
pub fn expected_fingerprint(major: u32, platform: &str) -> Option<&'static ChromeFingerprint> {
    if let Some(fingerprint) = CHROME_FINGERPRINTS
        .iter()
        .find(|fingerprint| fingerprint.major_version == major && fingerprint.platform == platform)
    {
        return Some(fingerprint);
    }

    let mut latest: Option<&'static ChromeFingerprint> = None;
    for fingerprint in CHROME_FINGERPRINTS {
        if fingerprint.platform == platform
            && latest.map(|current| current.major_version).unwrap_or(0) <= fingerprint.major_version
        {
            latest = Some(fingerprint);
        }
    }
    latest.or_else(|| CHROME_FINGERPRINTS.first())
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn catalogue_covers_multiple_chrome_majors() {
        let mut majors: Vec<u32> = CHROME_FINGERPRINTS
            .iter()
            .map(|fingerprint| fingerprint.major_version)
            .collect();
        majors.sort_unstable();
        majors.dedup();
        assert!(
            majors.len() >= 5,
            "fingerprint table covers {} majors, expected >=5",
            majors.len()
        );
    }

    #[test]
    fn catalogue_covers_desktop_and_mobile_platforms() {
        let mut platforms: Vec<&str> = CHROME_FINGERPRINTS
            .iter()
            .map(|fingerprint| fingerprint.platform)
            .collect();
        platforms.sort_unstable();
        platforms.dedup();
        for platform in ["Linux", "macOS", "Windows", "Android"] {
            assert!(
                platforms.contains(&platform),
                "missing platform: {platform}"
            );
        }
    }

    #[test]
    fn ja3_hashes_are_md5_length() {
        for fingerprint in CHROME_FINGERPRINTS {
            assert_eq!(
                fingerprint.ja3_hash.len(),
                32,
                "{}: ja3_hash must be 32 chars",
                fingerprint.name
            );
        }
    }

    #[test]
    fn expected_fingerprint_finds_exact_match() {
        let fingerprint = expected_fingerprint(134, "Linux").expect("must find Chrome 134/Linux");
        assert_eq!(fingerprint.major_version, 134);
        assert_eq!(fingerprint.platform, "Linux");
    }

    #[test]
    fn expected_fingerprint_falls_back_to_highest_same_platform() {
        let fingerprint =
            expected_fingerprint(9999, "Linux").expect("must fall back to a Linux entry");
        assert_eq!(fingerprint.platform, "Linux");
        assert!(fingerprint.major_version >= 130);
    }

    #[test]
    fn expected_fingerprint_falls_back_to_first_entry_for_unknown_platform() {
        assert_eq!(
            expected_fingerprint(134, "FreeBSD"),
            CHROME_FINGERPRINTS.first()
        );
    }

    #[test]
    fn ja3_strings_have_five_segments() {
        for fingerprint in CHROME_FINGERPRINTS {
            let segments: Vec<&str> = fingerprint.ja3.split(',').collect();
            assert_eq!(
                segments.len(),
                5,
                "{} ja3 string has wrong segment count: {}",
                fingerprint.name,
                fingerprint.ja3
            );
        }
    }

    #[test]
    fn ja4_strings_are_tls13_grade() {
        for fingerprint in CHROME_FINGERPRINTS {
            assert!(
                fingerprint.ja4.starts_with("t13d"),
                "{} ja4 does not look like TLS 1.3: {}",
                fingerprint.name,
                fingerprint.ja4
            );
        }
    }

    #[test]
    fn h2_fingerprints_have_four_segments() {
        for fingerprint in CHROME_FINGERPRINTS {
            let segments: Vec<&str> = fingerprint.h2_fingerprint.split('|').collect();
            assert_eq!(
                segments.len(),
                4,
                "{} h2 fingerprint has wrong segment count: {}",
                fingerprint.name,
                fingerprint.h2_fingerprint
            );
        }
    }
}