rama-tls 0.3.0

rama TLS-agnostic types and utilities
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
//! PeetPrint implementation for Rama (in Rust).
//!
//! PeetPrint is inspired by the custom fingerprint algorithm from TrackMe.
//! See license information below:
//!
//! > Original work from:
//! > <https://github.com/pagpeter/TrackMe>
//! >
//! > Licensed under GPLv3.
//! > See <https://github.com/plabayo/rama/blob/main/docs/thirdparty/licenses/pagpeter-trackme> for license details.

use crate::client::{ClientHello, ClientHelloExtension};
use crate::{
    ApplicationProtocol, CertificateCompressionAlgorithm, CipherSuite, ExtensionId,
    ProtocolVersion, SecureTransport, SignatureScheme, SupportedGroup,
};
use rama_core::extensions::Extensions;
use std::fmt;

#[derive(Clone)]
/// Input data for a "peetprint" fingerprint.
///
/// Computed using [`PeetPrint::compute`].
pub struct PeetPrint {
    supported_tls_versions: Vec<ProtocolVersion>,
    supported_protocols: Vec<&'static str>,
    supported_groups: Vec<SupportedGroup>,
    supported_signature_algorithms: Vec<SignatureScheme>,
    psk_key_exchange_mode: Option<u8>,
    certificate_compression_algorithms: Vec<CertificateCompressionAlgorithm>,
    cipher_suites: Vec<CipherSuite>,
    sorted_extensions: Vec<ExtensionId>,
}

impl PeetPrint {
    /// Compute the [`PeetPrint`].
    ///
    /// As specified by <https://github.com/pagpeter/TrackMe?tab=readme-ov-file#custom-fingerpint-peetprint>
    pub fn compute(ext: &Extensions) -> Result<Self, PeetComputeError> {
        let client_hello = ext
            .get_ref::<SecureTransport>()
            .and_then(|st| st.client_hello())
            .ok_or(PeetComputeError::MissingClientHello)?;
        Self::compute_from_client_hello(client_hello)
    }

    /// Compute the [`PeetPrint`] (hash) from a reference to a [`ClientHello`].
    ///
    /// In case your source is [`Extensions`] you can use [`Self::compute`] instead.
    ///
    /// [`ClientHello`]: crate::client::ClientHello
    pub fn compute_from_client_hello(client_hello: &ClientHello) -> Result<Self, PeetComputeError> {
        let cipher_suites = client_hello.cipher_suites().to_vec();

        if cipher_suites.is_empty() {
            return Err(PeetComputeError::EmptyCipherSuites);
        }

        let mut supported_tls_versions = Vec::new();
        let mut supported_protocols = Vec::new();
        let mut supported_groups = Vec::new();
        let mut supported_signature_algorithms = Vec::new();
        let mut psk_key_exchange_mode = None;
        let mut certificate_compression_algorithms = Vec::new();
        let mut sorted_extensions = Vec::new();

        for ext in client_hello.extensions() {
            let id = ext.id();
            sorted_extensions.push(id);

            if id.is_grease() {
                continue;
            }

            match ext {
                ClientHelloExtension::SupportedVersions(versions) => {
                    supported_tls_versions.extend(versions.iter().copied());
                }
                ClientHelloExtension::ApplicationLayerProtocolNegotiation(alpns) => {
                    for p in alpns {
                        match p {
                            ApplicationProtocol::HTTP_10 => {
                                supported_protocols.push("1.0");
                            }
                            ApplicationProtocol::HTTP_11 => {
                                supported_protocols.push("1.1");
                            }
                            ApplicationProtocol::HTTP_2 => {
                                supported_protocols.push("2");
                            }
                            _ => {}
                        }
                    }
                }
                ClientHelloExtension::SupportedGroups(groups) => {
                    supported_groups.extend(groups.iter().copied());
                }
                ClientHelloExtension::SignatureAlgorithms(algos) => {
                    supported_signature_algorithms.extend(algos.iter().copied());
                }
                ClientHelloExtension::Opaque { id: ext_id, data }
                    if *ext_id == ExtensionId::PSK_KEY_EXCHANGE_MODES =>
                {
                    if data.len() < 2 {
                        psk_key_exchange_mode = None;
                    } else {
                        psk_key_exchange_mode = Some(data[1]);
                    }
                }
                ClientHelloExtension::CertificateCompression(algs) => {
                    certificate_compression_algorithms.extend(algs.iter().cloned());
                }
                _ => {}
            }
        }

        // Sorting integer IDs in lexicographical order
        sorted_extensions.sort_by_key(|&id| {
            if id.is_grease() {
                return (1, [0xff; 5]);
            }
            let mut n = u16::from(id);
            let mut digits = [0u8; 5];
            let mut len = 0;
            if n == 0 {
                digits[0] = b'0';
            } else {
                while n > 0 {
                    digits[len] = b'0' + (n % 10) as u8;
                    n /= 10;
                    len += 1;
                }
                digits[..len].reverse();
            }
            (0, digits)
        });

        Ok(Self {
            supported_tls_versions,
            supported_protocols,
            supported_groups,
            supported_signature_algorithms,
            psk_key_exchange_mode,
            certificate_compression_algorithms,
            cipher_suites,
            sorted_extensions,
        })
    }

    #[inline]
    #[must_use]
    pub fn to_human_string(&self) -> String {
        format!("{self:?}")
    }
}

struct Md5Writer<'a>(&'a mut md5::Context);

impl fmt::Write for Md5Writer<'_> {
    fn write_str(&mut self, s: &str) -> fmt::Result {
        self.0.consume(s.as_bytes());
        Ok(())
    }
}

impl PeetPrint {
    fn write_to_fmt(&self, w: &mut impl fmt::Write) -> fmt::Result {
        fn write_joined_with_cb<W, T, F>(w: &mut W, items: &[T], cb: F) -> fmt::Result
        where
            W: fmt::Write,
            F: Fn(&mut W, &T) -> fmt::Result,
        {
            let mut iter = items.iter();
            if let Some(first) = iter.next() {
                cb(w, first)?;
                for part in iter {
                    write!(w, "-")?;
                    cb(w, part)?;
                }
            }
            Ok(())
        }

        fn write_joined<W, T>(w: &mut W, items: &[T]) -> fmt::Result
        where
            W: fmt::Write,
            T: fmt::Display,
        {
            write_joined_with_cb(w, items, |w, t| write!(w, "{t}"))
        }

        fn write_u16<W, T>(w: &mut W, items: &[T]) -> fmt::Result
        where
            W: fmt::Write,
            T: Copy,
            u16: From<T>,
        {
            write_joined_with_cb(w, items, |w, t| write!(w, "{}", u16::from(*t)))
        }

        fn write_u16_with_grease<W, T, F>(w: &mut W, items: &[T], is_grease: F) -> fmt::Result
        where
            W: fmt::Write,
            T: Copy,
            F: Fn(&T) -> bool,
            u16: From<T>,
        {
            write_joined_with_cb(w, items, |w, t| {
                if is_grease(t) {
                    write!(w, "GREASE")
                } else {
                    write!(w, "{}", u16::from(*t))
                }
            })
        }

        write_u16_with_grease(w, &self.supported_tls_versions, ProtocolVersion::is_grease)?;
        write!(w, "|")?;

        write_joined(w, &self.supported_protocols)?;
        write!(w, "|")?;

        write_u16_with_grease(w, &self.supported_groups, SupportedGroup::is_grease)?;
        write!(w, "|")?;

        write_u16_with_grease(
            w,
            &self.supported_signature_algorithms,
            SignatureScheme::is_grease,
        )?;
        write!(w, "|")?;

        if let Some(mode) = self.psk_key_exchange_mode {
            write!(w, "{mode}|")?;
        } else {
            write!(w, "|")?;
        }

        write_u16(w, &self.certificate_compression_algorithms)?;
        write!(w, "|")?;

        write_u16_with_grease(w, &self.cipher_suites, CipherSuite::is_grease)?;
        write!(w, "|")?;

        write_u16_with_grease(w, &self.sorted_extensions, ExtensionId::is_grease)?;

        Ok(())
    }

    pub fn fmt_as(&self, f: &mut fmt::Formatter<'_>, hash_chunks: bool) -> fmt::Result {
        if hash_chunks {
            let mut ctx = md5::Context::new();
            {
                let mut writer = Md5Writer(&mut ctx);
                self.write_to_fmt(&mut writer)?;
            }
            let digest = ctx.finalize();
            write!(f, "{}", hex::encode(*digest))
        } else {
            self.write_to_fmt(f)
        }
    }
}

impl fmt::Display for PeetPrint {
    #[inline]
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        self.fmt_as(f, true)
    }
}

impl fmt::Debug for PeetPrint {
    #[inline]
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        self.fmt_as(f, false)
    }
}

#[derive(Debug, Clone)]
/// error identifying a failure in [`PeetPrint::compute`]
pub enum PeetComputeError {
    /// missing [`ClientHello`]
    ///
    /// [`ClientHello`]: crate::client::ClientHello
    MissingClientHello,
    /// cipher suites was empty
    EmptyCipherSuites,
    /// invalid tls version
    InvalidTlsVersion,
}

impl fmt::Display for PeetComputeError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::MissingClientHello => write!(f, "PeetPrint: missing client hello"),
            Self::EmptyCipherSuites => write!(f, "PeetPrint: no cipher suites found"),
            Self::InvalidTlsVersion => {
                write!(f, "Peet Compute Error: invalid tls version")
            }
        }
    }
}

impl std::error::Error for PeetComputeError {}

#[cfg(test)]
mod tests {
    use crate::client::parse_client_hello;

    use super::*;

    #[derive(Debug)]
    struct TestCase {
        client_hello: Vec<u8>,
        pcap: &'static str,
        expected_peet_str: &'static str,
        expected_peet_hash: &'static str,
    }

    #[test]
    fn test_peet_compute() {
        let test_cases = [
            TestCase {
                client_hello: vec![
                    0x3, 0x3, 0x86, 0xad, 0xa4, 0xcc, 0x19, 0xe7, 0x14, 0x54, 0x54, 0xfd, 0xe7,
                    0x37, 0x33, 0xdf, 0x66, 0xcb, 0xf6, 0xef, 0x3e, 0xc0, 0xa1, 0x54, 0xc6, 0xdd,
                    0x14, 0x5e, 0xc0, 0x83, 0xac, 0xb9, 0xb4, 0xe7, 0x20, 0x1c, 0x64, 0xae, 0xa7,
                    0xa2, 0xc3, 0xe1, 0x8c, 0xd1, 0x25, 0x2, 0x4d, 0xf7, 0x86, 0x4a, 0xc7, 0x19,
                    0xd0, 0xc4, 0xbd, 0xfb, 0x40, 0xc2, 0xef, 0x7f, 0x6d, 0xd3, 0x9a, 0xa7, 0x53,
                    0xdf, 0xdd, 0x0, 0x22, 0x1a, 0x1a, 0x13, 0x1, 0x13, 0x2, 0x13, 0x3, 0xc0, 0x2b,
                    0xc0, 0x2f, 0xc0, 0x2c, 0xc0, 0x30, 0xcc, 0xa9, 0xcc, 0xa8, 0xc0, 0x13, 0xc0,
                    0x14, 0x0, 0x9c, 0x0, 0x9d, 0x0, 0x2f, 0x0, 0x35, 0x0, 0xa, 0x1, 0x0, 0x1,
                    0x91, 0xa, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x1e, 0x0, 0x0, 0x1b, 0x67,
                    0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x61, 0x64, 0x73, 0x2e, 0x67, 0x2e, 0x64, 0x6f,
                    0x75, 0x62, 0x6c, 0x65, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x2e, 0x6e, 0x65, 0x74,
                    0x0, 0x17, 0x0, 0x0, 0xff, 0x1, 0x0, 0x1, 0x0, 0x0, 0xa, 0x0, 0xa, 0x0, 0x8,
                    0x9a, 0x9a, 0x0, 0x1d, 0x0, 0x17, 0x0, 0x18, 0x0, 0xb, 0x0, 0x2, 0x1, 0x0, 0x0,
                    0x23, 0x0, 0x0, 0x0, 0x10, 0x0, 0xe, 0x0, 0xc, 0x2, 0x68, 0x32, 0x8, 0x68,
                    0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, 0x0, 0x5, 0x0, 0x5, 0x1, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0xd, 0x0, 0x14, 0x0, 0x12, 0x4, 0x3, 0x8, 0x4, 0x4, 0x1, 0x5,
                    0x3, 0x8, 0x5, 0x5, 0x1, 0x8, 0x6, 0x6, 0x1, 0x2, 0x1, 0x0, 0x12, 0x0, 0x0,
                    0x0, 0x33, 0x0, 0x2b, 0x0, 0x29, 0x9a, 0x9a, 0x0, 0x1, 0x0, 0x0, 0x1d, 0x0,
                    0x20, 0x59, 0x8, 0x6f, 0x41, 0x9a, 0xa5, 0xaa, 0x1d, 0x81, 0xe3, 0x47, 0xf0,
                    0x25, 0x5f, 0x92, 0x7, 0xfc, 0x4b, 0x13, 0x74, 0x51, 0x46, 0x98, 0x8, 0x74,
                    0x3b, 0xde, 0x57, 0x86, 0xe8, 0x2c, 0x74, 0x0, 0x2d, 0x0, 0x2, 0x1, 0x1, 0x0,
                    0x2b, 0x0, 0xb, 0xa, 0xfa, 0xfa, 0x3, 0x4, 0x3, 0x3, 0x3, 0x2, 0x3, 0x1, 0x0,
                    0x1b, 0x0, 0x3, 0x2, 0x0, 0x2, 0xba, 0xba, 0x0, 0x1, 0x0, 0x0, 0x15, 0x0, 0xbd,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
                ],
                pcap: "chrome-grease-single.pcap",
                expected_peet_str: "GREASE-772-771-770-769|2-1.1|GREASE-29-23-24|1027-2052-1025-1283-2053-1281-2054-1537-513|1|2|GREASE-4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53-10|0-10-11-13-16-18-21-23-27-35-43-45-5-51-65281-GREASE-GREASE",
                expected_peet_hash: "83a4e25726a3ba837aa2a9f1162b7063",
            },
            TestCase {
                client_hello: vec![
                    0x03, 0x03, 0x2e, 0x2b, 0xc2, 0x97, 0x7b, 0xf0, 0x7f, 0x95, 0x26, 0xed, 0xbd,
                    0x90, 0x70, 0xd0, 0xa2, 0xce, 0xb4, 0xf8, 0x37, 0xde, 0xb1, 0xd6, 0x21, 0x0f,
                    0x57, 0xbf, 0x65, 0x6e, 0x6b, 0x2c, 0x12, 0xd6, 0x20, 0x88, 0xb3, 0x75, 0x0c,
                    0x87, 0x77, 0xf6, 0x8b, 0xb1, 0x9e, 0x5b, 0xeb, 0x5b, 0x2b, 0xcd, 0x9b, 0x4f,
                    0x47, 0x7e, 0x5c, 0x0d, 0xe3, 0x04, 0x13, 0x6a, 0x29, 0x8e, 0xfc, 0x67, 0x93,
                    0xa5, 0x7b, 0x00, 0x22, 0x13, 0x01, 0x13, 0x03, 0x13, 0x02, 0xc0, 0x2b, 0xc0,
                    0x2f, 0xcc, 0xa9, 0xcc, 0xa8, 0xc0, 0x2c, 0xc0, 0x30, 0xc0, 0x0a, 0xc0, 0x09,
                    0xc0, 0x13, 0xc0, 0x14, 0x00, 0x9c, 0x00, 0x9d, 0x00, 0x2f, 0x00, 0x35, 0x01,
                    0x00, 0x03, 0x5b, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x0b, 0x74,
                    0x6c, 0x73, 0x2e, 0x70, 0x65, 0x65, 0x74, 0x2e, 0x77, 0x73, 0x00, 0x17, 0x00,
                    0x00, 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x0e, 0x00, 0x0c, 0x00,
                    0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x01, 0x00, 0x01, 0x01, 0x00, 0x0b,
                    0x00, 0x02, 0x01, 0x00, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x0c, 0x02, 0x68, 0x32,
                    0x08, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, 0x00, 0x05, 0x00, 0x05,
                    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x0a, 0x00, 0x08, 0x04, 0x03,
                    0x05, 0x03, 0x06, 0x03, 0x02, 0x03, 0x00, 0x33, 0x00, 0x6b, 0x00, 0x69, 0x00,
                    0x1d, 0x00, 0x20, 0xf3, 0x93, 0x44, 0xab, 0xc7, 0x17, 0xc9, 0x5e, 0x14, 0xea,
                    0xbe, 0x86, 0x04, 0xb5, 0xde, 0xc9, 0x3d, 0x05, 0x54, 0x90, 0x5d, 0xbc, 0x8c,
                    0x39, 0xf5, 0xe3, 0x29, 0x0b, 0x31, 0x53, 0x02, 0x7d, 0x00, 0x17, 0x00, 0x41,
                    0x04, 0x46, 0x67, 0xfa, 0x13, 0x77, 0x57, 0x41, 0x64, 0xc1, 0xc3, 0x48, 0x3a,
                    0x92, 0x7c, 0xeb, 0x14, 0x91, 0xfd, 0x80, 0x8e, 0x0f, 0x99, 0x8e, 0x0c, 0x40,
                    0xc0, 0x11, 0x96, 0x1e, 0x79, 0x62, 0x5c, 0x96, 0xdb, 0x3d, 0x43, 0x1e, 0xbb,
                    0x87, 0x5c, 0x87, 0xb7, 0x63, 0x38, 0x56, 0xfd, 0xae, 0x75, 0x3e, 0xdb, 0x10,
                    0xb8, 0xbf, 0x6c, 0x3b, 0x2d, 0x8c, 0x14, 0x17, 0xe0, 0x03, 0x2d, 0x17, 0x66,
                    0x00, 0x2b, 0x00, 0x05, 0x04, 0x03, 0x04, 0x03, 0x03, 0x00, 0x0d, 0x00, 0x18,
                    0x00, 0x16, 0x04, 0x03, 0x05, 0x03, 0x06, 0x03, 0x08, 0x04, 0x08, 0x05, 0x08,
                    0x06, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x02, 0x03, 0x02, 0x01, 0x00, 0x2d,
                    0x00, 0x02, 0x01, 0x01, 0x00, 0x1c, 0x00, 0x02, 0x40, 0x01, 0xfe, 0x0d, 0x01,
                    0xb9, 0x00, 0x00, 0x01, 0x00, 0x03, 0x16, 0x00, 0x20, 0x9c, 0xa1, 0xb1, 0x22,
                    0x26, 0x50, 0xc3, 0xd9, 0x03, 0x17, 0xd8, 0xa5, 0x00, 0x15, 0xbc, 0x58, 0x9d,
                    0x38, 0xd0, 0x83, 0x23, 0x4e, 0xba, 0x28, 0xd9, 0xea, 0x08, 0x20, 0x0e, 0xc6,
                    0x05, 0xc4, 0x01, 0x8f, 0xdb, 0x9f, 0xde, 0x6e, 0xb6, 0xc6, 0xb5, 0xf8, 0x8d,
                    0x20, 0xef, 0xe1, 0x41, 0x63, 0xce, 0xd3, 0x9e, 0x97, 0x75, 0x5a, 0x93, 0x1d,
                    0x87, 0x1d, 0x8a, 0x02, 0xde, 0x43, 0xe3, 0x4f, 0x42, 0x7f, 0x4e, 0xa0, 0x71,
                    0x94, 0xb8, 0x25, 0x8f, 0x20, 0x3d, 0x19, 0x87, 0xe2, 0x8a, 0x2c, 0xda, 0x8b,
                    0xfc, 0x61, 0xab, 0x2a, 0x0c, 0x7a, 0x05, 0x7d, 0x96, 0xfa, 0xca, 0x1a, 0x6e,
                    0x48, 0x49, 0xe3, 0xf6, 0xdd, 0xa6, 0x54, 0x39, 0xab, 0xd2, 0x4b, 0xb7, 0x46,
                    0xa8, 0x31, 0xdc, 0xa0, 0x0c, 0x02, 0x59, 0xc7, 0x09, 0x3c, 0x51, 0xa3, 0x06,
                    0xb5, 0xff, 0x14, 0xd6, 0x8a, 0x34, 0xb5, 0x26, 0xa6, 0x09, 0x4e, 0xf9, 0x24,
                    0xe8, 0x5b, 0x9d, 0x81, 0xb9, 0x0f, 0xeb, 0xf3, 0x67, 0x9c, 0x3e, 0xfe, 0x12,
                    0xd4, 0x98, 0x73, 0x0a, 0xe8, 0x16, 0x97, 0xb7, 0x9e, 0x56, 0x4b, 0x89, 0x09,
                    0xcb, 0x1b, 0xb9, 0xc3, 0xff, 0x74, 0x5f, 0x9b, 0x70, 0x92, 0xcf, 0xd6, 0xb6,
                    0xe6, 0x2d, 0x48, 0xc1, 0x96, 0xee, 0xea, 0x41, 0x65, 0x83, 0x38, 0x62, 0x31,
                    0x5d, 0xce, 0x82, 0xcc, 0xf3, 0xf5, 0x3d, 0x50, 0x19, 0xf7, 0x23, 0x20, 0xaf,
                    0x34, 0xcb, 0x31, 0xac, 0xc4, 0x9a, 0xef, 0x87, 0x3c, 0x2b, 0x7a, 0x28, 0x33,
                    0xbb, 0xb4, 0x70, 0xf1, 0xcd, 0x2b, 0xb1, 0x7c, 0x71, 0x5b, 0x2e, 0x62, 0x04,
                    0xd2, 0xdc, 0xe9, 0x39, 0x98, 0x4a, 0x73, 0x8b, 0x40, 0x07, 0xa4, 0x58, 0xbd,
                    0x13, 0x22, 0xa0, 0xeb, 0x74, 0xa8, 0x1e, 0xa3, 0x93, 0x12, 0x1f, 0x22, 0xcd,
                    0xb8, 0x9a, 0xa3, 0xb5, 0xbf, 0xda, 0x63, 0xaf, 0xbe, 0x13, 0xff, 0x0e, 0x47,
                    0xfa, 0x55, 0x2c, 0x25, 0x31, 0x31, 0x4c, 0xeb, 0x0b, 0x84, 0xbf, 0x36, 0xa9,
                    0x62, 0x5a, 0x54, 0x2f, 0x7a, 0x2f, 0xf0, 0xf7, 0x50, 0xa0, 0x90, 0x7e, 0xa9,
                    0x7d, 0x1c, 0xb7, 0xd1, 0xbc, 0x7f, 0xc3, 0xc1, 0x09, 0xa9, 0x53, 0x37, 0x0a,
                    0x42, 0x63, 0xe3, 0x18, 0x40, 0xad, 0x67, 0x10, 0xf0, 0x0b, 0xcc, 0xe7, 0x06,
                    0xf8, 0xa6, 0x86, 0xbd, 0xad, 0x92, 0x3f, 0x47, 0x51, 0xdb, 0x53, 0x66, 0xf3,
                    0xb0, 0x87, 0x20, 0x45, 0x3e, 0x55, 0xf1, 0x9a, 0xeb, 0x33, 0xfb, 0x48, 0x77,
                    0x79, 0x73, 0xbc, 0x5e, 0xa2, 0xcc, 0x54, 0x94, 0xf4, 0x2f, 0x85, 0x30, 0xb0,
                    0x58, 0x45, 0x4f, 0x50, 0x98, 0x27, 0x62, 0xe8, 0xd1, 0xb6, 0x5c, 0x54, 0xd2,
                    0xf2, 0x4e, 0xd3, 0x02, 0xb2, 0x8e, 0xcd, 0xd5, 0x19, 0xc8, 0xec, 0x9f, 0xc6,
                    0xa8, 0x07, 0x10, 0xbd, 0xb5, 0xc4, 0xa3, 0xf3, 0xe9, 0x6e, 0xa0, 0xdc, 0x5c,
                    0x31, 0x90, 0x51, 0xe0, 0x62, 0x79, 0x52, 0xcb, 0x7f, 0x90, 0x94, 0x85, 0x34,
                    0xc5, 0x47, 0x77, 0xb4, 0xeb, 0x79, 0x0a, 0xfc, 0xdd, 0x86, 0x08, 0x5d, 0x93,
                    0x77, 0x12, 0xf8, 0x7a, 0x2b, 0x33, 0x3c, 0x96, 0xfe, 0x4c, 0x5a, 0xc7, 0xdf,
                    0x00, 0x29, 0x00, 0x9c, 0x00, 0x77, 0x00, 0x71, 0xa0, 0x88, 0xb3, 0x29, 0x55,
                    0xf3, 0xf0, 0xc2, 0x89, 0x8e, 0x74, 0x36, 0x3a, 0x69, 0xf9, 0x5c, 0xba, 0x21,
                    0x3e, 0xe7, 0xf7, 0x42, 0x8b, 0x72, 0xb6, 0xca, 0x9b, 0x1f, 0x54, 0x7b, 0x78,
                    0x09, 0x23, 0xb1, 0xb4, 0xc3, 0xca, 0x84, 0xde, 0x1b, 0xa7, 0xd9, 0xec, 0xc4,
                    0x2f, 0xed, 0xb6, 0x16, 0x7a, 0xbb, 0xe9, 0x07, 0x0d, 0xe6, 0x23, 0x94, 0x17,
                    0x59, 0x26, 0xc3, 0x69, 0x6e, 0x3a, 0xa9, 0xad, 0x98, 0xc4, 0xa2, 0x88, 0x14,
                    0x7e, 0x61, 0xde, 0x6c, 0x2b, 0xca, 0x0b, 0xa1, 0x7f, 0xc2, 0xb5, 0x3d, 0xd8,
                    0x73, 0xde, 0x69, 0xde, 0x31, 0x42, 0x6f, 0x47, 0xf1, 0x34, 0x0b, 0x67, 0x54,
                    0xef, 0x0d, 0xa4, 0x50, 0x1d, 0x86, 0xb8, 0xa3, 0xd3, 0xfe, 0x05, 0xec, 0x38,
                    0x3d, 0xf5, 0x21, 0xcb, 0x8f, 0x51, 0x58, 0x92, 0x00, 0x21, 0x20, 0x0d, 0x79,
                    0xb1, 0x50, 0xb1, 0x58, 0x91, 0xa3, 0x7b, 0xef, 0x37, 0xaf, 0x0b, 0xdc, 0xae,
                    0x17, 0x79, 0x81, 0xf6, 0xe6, 0x0e, 0x78, 0x89, 0xad, 0xeb, 0x7a, 0xb8, 0xa3,
                    0x5a, 0x76, 0x69, 0xd1,
                ],
                pcap: "firefox.pcap",
                expected_peet_str: "772-771|2-1.1|29-23-24-25-256-257|1027-1283-1539-2052-2053-2054-1025-1281-1537-515-513|1||4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-156-157-47-53|0-10-11-13-16-23-28-34-41-43-45-5-51-65037-65281",
                expected_peet_hash: "34e94a61683a1fdaec9a41e8dae2d777",
            },
            TestCase {
                client_hello: vec![
                    0x03, 0x03, 0xcb, 0x7a, 0x3c, 0x3d, 0x2d, 0x18, 0x43, 0x67, 0xbc, 0x5a, 0x07,
                    0x17, 0x29, 0x71, 0xaf, 0x4b, 0xc0, 0xb3, 0x81, 0x68, 0xd4, 0x96, 0x29, 0xb0,
                    0xdc, 0x44, 0xc2, 0x69, 0xcc, 0x1c, 0x95, 0x05, 0x20, 0x8c, 0xaa, 0x3a, 0xf7,
                    0xe7, 0x74, 0xfe, 0x51, 0xab, 0xf7, 0x42, 0xe5, 0x6f, 0xfe, 0x24, 0x48, 0x20,
                    0xac, 0xe0, 0xd8, 0x84, 0xc5, 0xb2, 0x40, 0x5a, 0xcc, 0x3c, 0x95, 0x2f, 0x28,
                    0x32, 0x16, 0x00, 0x20, 0x8a, 0x8a, 0x13, 0x01, 0x13, 0x02, 0x13, 0x03, 0xc0,
                    0x2b, 0xc0, 0x2f, 0xc0, 0x2c, 0xc0, 0x30, 0xcc, 0xa9, 0xcc, 0xa8, 0xc0, 0x13,
                    0xc0, 0x14, 0x00, 0x9c, 0x00, 0x9d, 0x00, 0x2f, 0x00, 0x35, 0x01, 0x00, 0x06,
                    0xe7, 0x7a, 0x7a, 0x00, 0x00, 0xfe, 0x0d, 0x00, 0xba, 0x00, 0x00, 0x01, 0x00,
                    0x01, 0x36, 0x00, 0x20, 0x05, 0x41, 0x66, 0x63, 0x69, 0xa2, 0x87, 0x5c, 0x7d,
                    0x1e, 0xbb, 0xf1, 0xf8, 0x99, 0xfd, 0x9b, 0x7d, 0x12, 0x8c, 0xfb, 0x3f, 0xf1,
                    0xfb, 0x0f, 0x19, 0xc0, 0x73, 0xa2, 0xe1, 0xf8, 0x8d, 0x24, 0x00, 0x90, 0x19,
                    0x21, 0x97, 0x7a, 0xdf, 0x76, 0xf5, 0xc6, 0x91, 0xd5, 0xc8, 0xe7, 0x64, 0xeb,
                    0x2d, 0x98, 0xb2, 0xed, 0x3f, 0x38, 0xbf, 0x67, 0xdd, 0x53, 0x25, 0xd7, 0xd9,
                    0x5d, 0x49, 0xd2, 0x3e, 0x6d, 0x2a, 0x96, 0xc2, 0x17, 0xa1, 0x27, 0x8d, 0xa3,
                    0x4e, 0xb4, 0xe8, 0x8d, 0x2d, 0xc7, 0x86, 0x9e, 0x78, 0x1b, 0xe2, 0x80, 0xce,
                    0xf6, 0x10, 0xbc, 0xc5, 0x1d, 0xfd, 0x12, 0x40, 0x90, 0xb5, 0x98, 0x48, 0x28,
                    0x02, 0x9d, 0xec, 0xb5, 0xad, 0x5f, 0x10, 0xb1, 0xb2, 0xbd, 0x9d, 0xd0, 0xb9,
                    0x44, 0xc9, 0x69, 0xe4, 0x1b, 0xbc, 0x69, 0xf8, 0xd2, 0xc8, 0x92, 0xaf, 0x14,
                    0x23, 0xcd, 0xe3, 0x67, 0xf7, 0x0a, 0x25, 0x60, 0xb9, 0x92, 0x03, 0xa7, 0x5a,
                    0xc8, 0xf3, 0x60, 0xf0, 0x07, 0xc5, 0x24, 0x96, 0x82, 0x41, 0xd5, 0xa1, 0xce,
                    0x5d, 0x93, 0x47, 0xda, 0xbe, 0xd3, 0xed, 0xf0, 0xac, 0xe2, 0xb1, 0xe2, 0x96,
                    0x99, 0x13, 0x3f, 0xf0, 0xc3, 0x50, 0xd4, 0xdf, 0xf8, 0x8d, 0xdd, 0x98, 0xd5,
                    0x00, 0x0d, 0x00, 0x12, 0x00, 0x10, 0x04, 0x03, 0x08, 0x04, 0x04, 0x01, 0x05,
                    0x03, 0x08, 0x05, 0x05, 0x01, 0x08, 0x06, 0x06, 0x01, 0x00, 0x1b, 0x00, 0x03,
                    0x02, 0x00, 0x02, 0x00, 0x05, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x2d, 0x00, 0x02, 0x01, 0x01, 0x00, 0x17, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0c,
                    0x00, 0x0a, 0xaa, 0xaa, 0x11, 0xec, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00,
                    0x2b, 0x00, 0x07, 0x06, 0x5a, 0x5a, 0x03, 0x04, 0x03, 0x03, 0x00, 0x10, 0x00,
                    0x0e, 0x00, 0x0c, 0x02, 0x68, 0x32, 0x08, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31,
                    0x2e, 0x31, 0x44, 0xcd, 0x00, 0x05, 0x00, 0x03, 0x02, 0x68, 0x32, 0x00, 0x23,
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x00, 0x0b, 0x74, 0x6c,
                    0x73, 0x2e, 0x70, 0x65, 0x65, 0x74, 0x2e, 0x77, 0x73, 0x00, 0x12, 0x00, 0x00,
                    0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x33,
                    0x04, 0xef, 0x04, 0xed, 0xaa, 0xaa, 0x00, 0x01, 0x00, 0x11, 0xec, 0x04, 0xc0,
                    0x42, 0xf2, 0x14, 0xff, 0xbb, 0x26, 0x69, 0x56, 0x93, 0x5a, 0x84, 0xa6, 0xa6,
                    0x9c, 0x34, 0xda, 0x20, 0xcb, 0x30, 0x47, 0x57, 0x46, 0xa0, 0xad, 0xdd, 0xe4,
                    0xa4, 0xe5, 0x06, 0x67, 0x61, 0xd7, 0x9e, 0xc2, 0xb8, 0xbf, 0x96, 0xa8, 0xb9,
                    0x84, 0xb2, 0x80, 0x18, 0x51, 0x79, 0x39, 0x1a, 0xaf, 0x40, 0xc2, 0xc4, 0xc0,
                    0xc8, 0x99, 0x09, 0x45, 0x40, 0x7e, 0xe9, 0x80, 0xf1, 0xb9, 0x0c, 0xc5, 0xf6,
                    0x43, 0xa1, 0x00, 0x96, 0xff, 0xc5, 0x7f, 0x74, 0x52, 0xba, 0x1e, 0x0a, 0x3a,
                    0x57, 0x28, 0xa9, 0x6e, 0x28, 0x82, 0xa6, 0xac, 0xa5, 0xdc, 0x96, 0x79, 0xb0,
                    0x6b, 0x27, 0xa7, 0xd1, 0x15, 0xf3, 0xb8, 0x5a, 0xca, 0x28, 0x34, 0x74, 0x7c,
                    0x8c, 0x6a, 0x83, 0x2b, 0x69, 0xc2, 0xc0, 0x1e, 0x19, 0x64, 0xf0, 0x17, 0x99,
                    0x59, 0x6b, 0x4c, 0x11, 0x36, 0x40, 0x49, 0xdc, 0x07, 0xa5, 0x30, 0x3f, 0x63,
                    0x51, 0x21, 0x27, 0x4b, 0x3a, 0xe6, 0x91, 0x66, 0x2c, 0x7c, 0x62, 0x38, 0x93,
                    0xaf, 0x1e, 0xc1, 0x15, 0x80, 0x12, 0x39, 0x5a, 0x78, 0xbb, 0x76, 0x74, 0xb0,
                    0xb6, 0x64, 0xc9, 0x84, 0x5b, 0x01, 0x18, 0x16, 0x79, 0x04, 0x56, 0x0f, 0xc5,
                    0xbc, 0x80, 0x51, 0x38, 0xc7, 0xac, 0x1b, 0x9d, 0xa8, 0x71, 0x3e, 0x14, 0xf2,
                    0x23, 0x92, 0x1c, 0x2f, 0x9d, 0x17, 0x62, 0x60, 0xcc, 0x35, 0xc1, 0x00, 0x6d,
                    0x01, 0x50, 0xc3, 0x2d, 0xe3, 0x72, 0x14, 0xf7, 0x80, 0x8e, 0xf8, 0x5f, 0x51,
                    0xe0, 0x79, 0x81, 0xa3, 0x93, 0x23, 0xeb, 0x00, 0x8a, 0x13, 0x1d, 0xf4, 0xe2,
                    0xa5, 0x90, 0x9b, 0x33, 0x09, 0x07, 0xb5, 0xa0, 0x8c, 0x8d, 0xf6, 0xc2, 0x3e,
                    0xb3, 0x96, 0x1c, 0xe7, 0x86, 0x48, 0x94, 0x87, 0x2c, 0xd4, 0xfc, 0x28, 0x7e,
                    0x76, 0x92, 0x47, 0x9c, 0x50, 0x30, 0x6c, 0x7e, 0xc9, 0xf7, 0x4b, 0xe3, 0x5a,
                    0x5d, 0x24, 0x6b, 0x67, 0xaf, 0x82, 0x8d, 0x36, 0x1b, 0x31, 0x39, 0x61, 0xb6,
                    0xa4, 0xd0, 0x7e, 0xa3, 0xc2, 0x93, 0xbe, 0xc3, 0x9e, 0xa7, 0x39, 0x39, 0x0e,
                    0x99, 0xba, 0xa1, 0xf0, 0x65, 0x98, 0x5a, 0x69, 0x52, 0x17, 0x4a, 0x61, 0xea,
                    0x04, 0xc7, 0x29, 0x13, 0x8e, 0xe8, 0x0c, 0xff, 0xaa, 0xaa, 0x10, 0xc6, 0xa0,
                    0xac, 0xd5, 0xc9, 0x91, 0x06, 0x94, 0xb4, 0x99, 0x3c, 0x35, 0x8b, 0x1e, 0x02,
                    0xdb, 0x93, 0x4d, 0x92, 0x04, 0x3f, 0x07, 0xb7, 0x9b, 0xa0, 0x85, 0xdd, 0x12,
                    0xa4, 0x81, 0xa7, 0xbd, 0xe0, 0x31, 0x85, 0x3c, 0x71, 0x65, 0x42, 0x25, 0x7a,
                    0x8d, 0x12, 0x6d, 0xc9, 0x04, 0x40, 0x58, 0x1c, 0x16, 0xdf, 0x0a, 0x81, 0xa8,
                    0xd0, 0x47, 0x0a, 0xf3, 0x0c, 0x74, 0x3a, 0x04, 0xb4, 0xf4, 0xa0, 0x48, 0xeb,
                    0x1d, 0x90, 0x6c, 0xb5, 0x65, 0xf1, 0x1f, 0xd3, 0x84, 0x99, 0x2f, 0xea, 0xc8,
                    0x16, 0x1c, 0x6f, 0xed, 0xdb, 0x16, 0x67, 0x28, 0x4e, 0xff, 0x9b, 0x04, 0xf6,
                    0x3b, 0x0c, 0x88, 0x75, 0x5f, 0x09, 0xf6, 0x51, 0x01, 0xf8, 0xcd, 0xe8, 0x26,
                    0x76, 0x0d, 0xe6, 0x99, 0x4a, 0xd9, 0x6c, 0xa1, 0xa5, 0x5f, 0xfa, 0x00, 0x43,
                    0x0d, 0xd8, 0x64, 0xbc, 0xd0, 0x05, 0x7f, 0xa0, 0x1a, 0xb4, 0xbc, 0xb0, 0xaf,
                    0x52, 0x42, 0x51, 0x5c, 0x88, 0xc2, 0x18, 0xac, 0x11, 0x11, 0x48, 0xef, 0x51,
                    0x12, 0x00, 0x94, 0x41, 0xe4, 0xc5, 0x6c, 0xcc, 0xac, 0x5d, 0xd8, 0xf4, 0x23,
                    0xf8, 0x58, 0x2c, 0x9e, 0xdb, 0xb7, 0x2b, 0xe6, 0x4b, 0x2a, 0x91, 0x15, 0x16,
                    0x15, 0x88, 0x54, 0x07, 0x7f, 0xae, 0x06, 0xaa, 0xd0, 0x51, 0xba, 0xe8, 0xf1,
                    0x38, 0xf2, 0xc4, 0x28, 0x9c, 0x59, 0xca, 0xdc, 0xd0, 0x81, 0x57, 0x16, 0xb5,
                    0xf1, 0x42, 0xa5, 0x28, 0x26, 0x96, 0x97, 0xc9, 0xce, 0x50, 0xa9, 0x51, 0x38,
                    0x32, 0x6a, 0x07, 0x37, 0xcd, 0xf5, 0xf3, 0x2d, 0xf0, 0xfa, 0x48, 0xea, 0xd3,
                    0xa4, 0x37, 0x85, 0xb6, 0xe9, 0x23, 0xaf, 0x5a, 0x7a, 0xba, 0x62, 0xe1, 0x57,
                    0x3e, 0xb8, 0x55, 0x7a, 0x35, 0x52, 0x9a, 0x83, 0x55, 0x9e, 0x77, 0xcb, 0x7f,
                    0xc8, 0x25, 0xa6, 0x67, 0xc7, 0xc6, 0x54, 0x8f, 0x58, 0x99, 0xac, 0x4e, 0x68,
                    0x1e, 0x4c, 0xc0, 0xab, 0x27, 0x46, 0x77, 0xb5, 0x07, 0x91, 0x37, 0x68, 0x77,
                    0x4e, 0x5b, 0x0b, 0x61, 0x28, 0x23, 0x26, 0x60, 0x04, 0x8f, 0x55, 0x96, 0x93,
                    0xc4, 0x27, 0x57, 0x61, 0xc9, 0x27, 0xa8, 0xa1, 0x58, 0x12, 0x22, 0x80, 0xa7,
                    0xb3, 0x6b, 0xbb, 0x02, 0xcd, 0x15, 0x2d, 0xa0, 0x1a, 0xa2, 0x63, 0x7a, 0x92,
                    0xfe, 0x45, 0xb6, 0x25, 0x7c, 0x3d, 0x1b, 0x26, 0x9f, 0xe0, 0xd9, 0xb9, 0xec,
                    0x60, 0x6a, 0xd4, 0x04, 0x20, 0x19, 0x59, 0x73, 0xe7, 0xc4, 0x99, 0xc5, 0x67,
                    0xc5, 0x9e, 0x5a, 0x1c, 0xc6, 0xe5, 0xb4, 0x8f, 0x28, 0x40, 0x9f, 0xf5, 0x8f,
                    0xd9, 0x22, 0x12, 0x33, 0xb3, 0x83, 0x19, 0x00, 0xaa, 0xba, 0x67, 0x92, 0x3d,
                    0x34, 0xa6, 0x47, 0x74, 0x71, 0xac, 0x60, 0xa7, 0x18, 0x52, 0x8c, 0x9c, 0x5b,
                    0x31, 0x4a, 0x80, 0xa3, 0x6b, 0x86, 0x6b, 0xd5, 0x82, 0xbc, 0x42, 0xcb, 0xc1,
                    0xfa, 0x2c, 0x99, 0x17, 0x15, 0x44, 0x7c, 0xb1, 0x0a, 0x5f, 0xf5, 0x23, 0x05,
                    0x23, 0x48, 0xc4, 0xb1, 0x64, 0xf9, 0x69, 0xc6, 0xf9, 0xb8, 0x65, 0x85, 0x71,
                    0xb2, 0xc7, 0x09, 0x8d, 0x76, 0x6b, 0xc3, 0x02, 0x32, 0x94, 0x72, 0xc0, 0x36,
                    0x08, 0x16, 0x63, 0x07, 0xc3, 0xa8, 0x21, 0x72, 0x52, 0xbc, 0xb4, 0x00, 0xbe,
                    0x20, 0x1d, 0x38, 0x73, 0x34, 0xea, 0xd0, 0x74, 0x1a, 0x28, 0xad, 0xd7, 0x87,
                    0x63, 0x99, 0x08, 0x5d, 0x32, 0xea, 0xc1, 0x8d, 0x14, 0x92, 0xa2, 0x48, 0x83,
                    0xed, 0x63, 0x08, 0x03, 0x8a, 0x6c, 0x99, 0x35, 0x75, 0x4d, 0x93, 0xbe, 0xb7,
                    0x37, 0x11, 0x75, 0x2c, 0xba, 0x60, 0x62, 0x3e, 0xa9, 0x85, 0x3e, 0xff, 0x75,
                    0xb4, 0xe5, 0x32, 0x97, 0x2e, 0xe3, 0xb3, 0x41, 0x72, 0x81, 0x15, 0x43, 0xb6,
                    0x6e, 0xe3, 0x68, 0x20, 0xe9, 0x2d, 0x8c, 0xb0, 0xb2, 0x44, 0x4c, 0x5b, 0x85,
                    0xe9, 0xba, 0x79, 0x54, 0xb9, 0x5b, 0xba, 0x80, 0x70, 0x41, 0xb2, 0xc6, 0x61,
                    0x61, 0xc3, 0xdb, 0x45, 0xb9, 0x06, 0x69, 0xbe, 0x59, 0x77, 0x1c, 0x10, 0x0f,
                    0x15, 0x61, 0x46, 0xf4, 0xc9, 0x1d, 0x04, 0xb8, 0x1b, 0x9e, 0x04, 0x28, 0xfb,
                    0x17, 0x31, 0x5a, 0x15, 0x69, 0x81, 0x19, 0x77, 0x70, 0x34, 0x17, 0x14, 0xaa,
                    0x9c, 0x14, 0x02, 0x3f, 0x78, 0x89, 0x5d, 0xff, 0x34, 0x38, 0x20, 0xd3, 0x0c,
                    0xf5, 0x62, 0xa3, 0x06, 0x73, 0xa1, 0x6f, 0x70, 0x5c, 0x0f, 0x20, 0x3d, 0x04,
                    0x78, 0xaa, 0xc4, 0x88, 0x30, 0xee, 0x10, 0x28, 0x12, 0x25, 0x42, 0xa9, 0x87,
                    0xa4, 0xc0, 0x0b, 0x4a, 0x99, 0xb8, 0x8c, 0xf1, 0x87, 0x0b, 0xa7, 0x22, 0x97,
                    0x1c, 0xb7, 0x82, 0x97, 0x91, 0x81, 0x95, 0x15, 0x54, 0x65, 0x85, 0xc3, 0xf0,
                    0x38, 0xc2, 0x37, 0xe0, 0x4f, 0x1c, 0x4a, 0xb6, 0x02, 0x31, 0xce, 0x90, 0x59,
                    0x64, 0xc4, 0xf8, 0xa1, 0x23, 0xeb, 0x55, 0x3e, 0x86, 0x2d, 0xb3, 0xa6, 0xa4,
                    0x3c, 0x74, 0x5c, 0xc8, 0xb7, 0x3e, 0x86, 0xab, 0x48, 0x8f, 0xe1, 0x1d, 0x69,
                    0x6c, 0x31, 0x24, 0x49, 0x54, 0xcf, 0xf6, 0x2a, 0x3e, 0xd5, 0x36, 0x5a, 0xe4,
                    0xca, 0x4c, 0xac, 0x9f, 0x09, 0xd2, 0x2b, 0x8e, 0xa4, 0x98, 0xaf, 0x19, 0xcd,
                    0x6d, 0x02, 0x4f, 0xb2, 0xf1, 0x4b, 0x55, 0x85, 0xb6, 0xdd, 0xc0, 0xc0, 0xe1,
                    0xe5, 0x1d, 0x83, 0x23, 0x76, 0xc5, 0xe8, 0xb3, 0xe8, 0x7a, 0x91, 0xd1, 0x43,
                    0x1f, 0xea, 0x92, 0xc4, 0x7e, 0xc1, 0x4c, 0x9f, 0xa2, 0xa2, 0x54, 0xdc, 0x11,
                    0xaa, 0xd2, 0xb8, 0x6f, 0x23, 0x81, 0xb4, 0xec, 0x3d, 0xb1, 0xaa, 0x79, 0x98,
                    0xf1, 0x06, 0x8f, 0x3b, 0xa6, 0x11, 0x77, 0x29, 0x4f, 0x74, 0xbe, 0x68, 0x73,
                    0x16, 0x9f, 0x16, 0x26, 0x5c, 0x9c, 0xc1, 0x83, 0x4b, 0x53, 0x54, 0x55, 0x0f,
                    0xc9, 0x90, 0x6a, 0x8e, 0x14, 0xc1, 0x70, 0x75, 0xca, 0x5f, 0x66, 0x22, 0xa2,
                    0xc9, 0x6e, 0x42, 0x40, 0x1f, 0x0f, 0x1a, 0xae, 0xa0, 0x32, 0xc9, 0xbe, 0x30,
                    0x25, 0x68, 0x2b, 0x8a, 0x94, 0x9a, 0x02, 0x4a, 0xe7, 0x53, 0xf9, 0xc6, 0x0c,
                    0x0f, 0x1c, 0x57, 0xb6, 0xea, 0xbd, 0xc9, 0x01, 0x9e, 0xac, 0x5c, 0xb6, 0x71,
                    0x40, 0x96, 0xf8, 0x04, 0x3d, 0x5f, 0xda, 0x5f, 0xc7, 0xd4, 0x44, 0x2c, 0x6b,
                    0x6e, 0xed, 0xda, 0xfb, 0xc6, 0x81, 0x17, 0x9a, 0xd1, 0xf7, 0x7b, 0x3e, 0x8f,
                    0x8d, 0x41, 0xdc, 0xcf, 0x81, 0x82, 0x60, 0x13, 0x8f, 0x9a, 0x33, 0xe9, 0x35,
                    0x74, 0x8b, 0xa5, 0x85, 0xb7, 0xed, 0xce, 0xc4, 0xd8, 0x4a, 0x62, 0x9f, 0xc4,
                    0x85, 0xf2, 0x48, 0x9a, 0xbd, 0x21, 0x18, 0xaa, 0x77, 0x5d, 0xf4, 0x07, 0x2c,
                    0x71, 0x36, 0x7e, 0xa0, 0xc2, 0x26, 0x45, 0x00, 0x1d, 0x00, 0x20, 0x0e, 0xeb,
                    0xeb, 0x71, 0x9a, 0xb6, 0x30, 0x76, 0xee, 0x9f, 0xc6, 0x9e, 0x9c, 0x8b, 0xfc,
                    0x40, 0xee, 0xa3, 0xde, 0xa2, 0xd0, 0x10, 0x4c, 0xf0, 0xec, 0x65, 0xd6, 0x80,
                    0x11, 0x5f, 0x39, 0x60, 0x9a, 0x9a, 0x00, 0x01, 0x00, 0x00, 0x29, 0x00, 0x9c,
                    0x00, 0x77, 0x00, 0x71, 0x3d, 0xc8, 0xa8, 0xef, 0xb6, 0x15, 0x4a, 0xc0, 0xf1,
                    0x85, 0x9f, 0xd4, 0xb6, 0x5e, 0xe0, 0xd5, 0xc1, 0xf1, 0xdf, 0x11, 0xeb, 0x8e,
                    0x78, 0x92, 0xac, 0x1d, 0x94, 0x20, 0xc5, 0x31, 0x16, 0x89, 0x41, 0x30, 0x7d,
                    0x06, 0x2f, 0xf0, 0x60, 0x44, 0x3a, 0x5c, 0xb3, 0x63, 0xa0, 0x6d, 0x3d, 0x97,
                    0x11, 0xd7, 0xfc, 0xb4, 0x50, 0xbe, 0x21, 0x7a, 0xd8, 0x9b, 0x9d, 0x78, 0x7b,
                    0x60, 0x68, 0xe1, 0xf1, 0x3c, 0x6d, 0x87, 0x7a, 0x47, 0xcf, 0xd0, 0x8b, 0x8f,
                    0xbd, 0x2d, 0xbd, 0xd3, 0x80, 0x18, 0x64, 0xe0, 0xe6, 0x10, 0x38, 0x57, 0x0c,
                    0x55, 0xf2, 0xa7, 0xb6, 0xca, 0xef, 0xb1, 0xfb, 0xd9, 0xee, 0x5e, 0x8a, 0x46,
                    0xf1, 0xa0, 0x4e, 0xda, 0xff, 0x64, 0x9b, 0x14, 0x46, 0xd4, 0xe8, 0x7b, 0xe8,
                    0xda, 0x23, 0xa9, 0x60, 0x00, 0x21, 0x20, 0x6d, 0xda, 0x29, 0x21, 0xc3, 0xdc,
                    0x25, 0xc3, 0xad, 0x3c, 0xdc, 0x6b, 0x33, 0x5a, 0xae, 0xec, 0x95, 0x86, 0xc9,
                    0xdc, 0x85, 0xc6, 0x9d, 0x54, 0xf9, 0x17, 0x44, 0x95, 0x3e, 0x72, 0x5b, 0x15,
                ],
                pcap: "brave.pcap",
                expected_peet_str: "GREASE-772-771|2-1.1|GREASE-4588-29-23-24|1027-2052-1025-1283-2053-1281-2054-1537|1|2|GREASE-4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53|0-10-11-13-16-17613-18-23-27-35-41-43-45-5-51-65037-65281-GREASE-GREASE",
                expected_peet_hash: "d44d68f0fce54cd423d6792272a242b8",
            },
        ];
        for test_case in test_cases {
            let ext = Extensions::new();
            ext.insert(SecureTransport::with_client_hello(
                parse_client_hello(&test_case.client_hello).expect(test_case.pcap),
            ));

            let peet = PeetPrint::compute(&ext).expect(test_case.pcap);

            assert_eq!(
                test_case.expected_peet_str,
                format!("{peet:?}"),
                "pcap: {}",
                test_case.pcap,
            );

            assert_eq!(
                test_case.expected_peet_hash,
                format!("{peet}"),
                "pcap: {}",
                test_case.pcap,
            );
        }
    }
}