MCPcopy Create free account
hub / github.com/BitVM/BitVM / create_test_vector

Function create_test_vector

bitvm/src/signatures/public.rs:650–687  ·  view source on GitHub ↗
(
        message: &WOTS::Message,
        secret_key: WinternitzSecret,
    )

Source from the content-addressed store, hash-verified

648 /// with the given `secret_key`.
649 #[allow(dead_code)]
650 fn create_test_vector<WOTS: Wots + CompactWots>(
651 message: &WOTS::Message,
652 secret_key: WinternitzSecret,
653 ) -> TestVector {
654 let public_key: Vec<Vec<u8>> = WOTS::generate_public_key(&secret_key)
655 .as_ref()
656 .iter()
657 .map(|entry| entry.to_vec())
658 .collect();
659 let witness: Vec<Vec<u8>> = WOTS::sign_to_raw_witness(&secret_key, message)
660 .iter()
661 .map(|entry| entry.to_vec())
662 .collect();
663 let signature: Vec<Vec<u8>> = WOTS::sign(&secret_key, message)
664 .as_ref()
665 .iter()
666 .map(|entry| entry.to_vec())
667 .collect();
668 let compact_witness: Vec<Vec<u8>> = WOTS::compact_sign_to_raw_witness(&secret_key, message)
669 .iter()
670 .map(|entry| entry.to_vec())
671 .collect();
672 let compact_signature: Vec<Vec<u8>> = WOTS::compact_sign(&secret_key, message)
673 .as_ref()
674 .iter()
675 .map(|entry| entry.to_vec())
676 .collect();
677
678 TestVector {
679 message: message.as_ref().to_vec(),
680 secret_key,
681 public_key,
682 witness,
683 signature,
684 compact_witness,
685 compact_signature,
686 }
687 }
688
689 /// Creates randomized test vectors for the given `WOTS` implementation.
690 #[allow(dead_code)]

Callers

nothing calls this directly

Calls 2

generate_public_keyFunction · 0.85
as_refMethod · 0.80

Tested by

no test coverage detected