MCPcopy Create free account
hub / github.com/docknetwork/crypto / test_conformance

Function test_conformance

merlin/src/strobe.rs:306–353  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

304
305 #[test]
306 fn test_conformance() {
307 let mut s1 = super::Strobe128::new(b"Conformance Test Protocol");
308 let mut s2 = strobe_rs::Strobe::new(b"Conformance Test Protocol", SecParam::B128);
309
310 // meta-AD(b"msg"); AD(msg)
311
312 let msg = [99u8; 1024];
313
314 s1.meta_ad(b"ms", false);
315 s1.meta_ad(b"g", true);
316 s1.ad(&msg, false);
317
318 s2.meta_ad(b"ms", false);
319 s2.meta_ad(b"g", true);
320 s2.ad(&msg, false);
321
322 // meta-AD(b"prf"); PRF()
323
324 let mut prf1 = [0u8; 32];
325 s1.meta_ad(b"prf", false);
326 s1.prf(&mut prf1, false);
327
328 let mut prf2 = [0u8; 32];
329 s2.meta_ad(b"prf", false);
330 s2.prf(&mut prf2, false);
331
332 assert_eq!(prf1, prf2);
333
334 // meta-AD(b"key"); KEY(prf output)
335
336 s1.meta_ad(b"key", false);
337 s1.key(&prf1, false);
338
339 s2.meta_ad(b"key", false);
340 s2.key(&prf2, false);
341
342 // meta-AD(b"prf"); PRF()
343
344 let mut prf1 = [0u8; 32];
345 s1.meta_ad(b"prf", false);
346 s1.prf(&mut prf1, false);
347
348 let mut prf2 = [0u8; 32];
349 s2.meta_ad(b"prf", false);
350 s2.prf(&mut prf2, false);
351
352 assert_eq!(prf1, prf2);
353 }
354}

Callers

nothing calls this directly

Calls 4

meta_adMethod · 0.80
adMethod · 0.80
prfMethod · 0.80
keyMethod · 0.80

Tested by

no test coverage detected