fn generate_test_vectors()

in src/main.rs [964:1048]


fn generate_test_vectors() -> Vec<TestVector> {
    let mut info = Builder::default();
    info.append("|  |    msg |    sig |  S   |    A  |    R  | cof-ed | cof-less |        comment        |\n");
    info.append("|---------------------------------------------------------------------------------------|\n");
    let mut vec = Vec::new();

    // #0: canonical S, small R, small A
    let (_tv1, tv2) = zero_small_small().unwrap();
    info.append(format!(
        "| 0| ..{:} | ..{:} |  = 0 | small | small |    V   |    V     | small A and R |\n",
        &hex::encode(&tv2.message)[60..],
        &hex::encode(&tv2.signature)[124..]
    ));
    vec.push(tv2); // passes cofactored, passes cofactorless

    // #1: canonical S, mixed R, small A
    let (_tv1, tv2) = non_zero_mixed_small().unwrap();
    info.append(format!(
        "| 1| ..{:} | ..{:} |  < L | small | mixed |    V   |    V     | small A only |\n",
        &hex::encode(&tv2.message)[60..],
        &hex::encode(&tv2.signature)[124..]
    ));
    vec.push(tv2); // passes cofactored, passes cofactorless

    // #2: canonical S, small R, mixed A
    let (_tv1, tv2) = non_zero_small_mixed().unwrap();
    info.append(format!(
        "| 2| ..{:} | ..{:} |  < L | mixed | small |    V   |    V     | small R only |\n",
        &hex::encode(&tv2.message)[60..],
        &hex::encode(&tv2.signature)[124..]
    ));
    vec.push(tv2); // passes cofactored, passes cofactorless

    // #3-4: canonical S, mixed R, mixed A
    let (tv1, tv2) = non_zero_mixed_mixed().unwrap();
    info.append(format!("| 3| ..{:} | ..{:} |  < L | mixed | mixed |    V   |    V     | succeeds unless full-order is checked |\n", &hex::encode(&tv2.message)[60..], &hex::encode(&tv2.signature)[124..]));
    vec.push(tv2); // passes cofactored, passes cofactorless
    info.append(format!(
        "| 4| ..{:} | ..{:} |  < L | mixed | mixed |    V   |    X     |  |\n",
        &hex::encode(&tv1.message)[60..],
        &hex::encode(&tv1.signature)[124..]
    ));
    vec.push(tv1); // passes cofactored, fails cofactorless

    // #5 Prereduce scalar which fails cofactorless
    let tv1 = pre_reduced_scalar();
    info.append(format!("| 5| ..{:} | ..{:} |  < L | mixed |   L   |    V*  |    X     | fails cofactored iff (8h) prereduced |\n", &hex::encode(&tv1.message)[60..], &hex::encode(&tv1.signature)[124..]));
    vec.push(tv1);

    // #6 Large S
    let tv1 = large_s().unwrap();
    info.append(format!(
        "| 6| ..{:} | ..{:} |  > L |   L   |   L   |    V   |    V     |  |\n",
        &hex::encode(&tv1.message)[60..],
        &hex::encode(&tv1.signature)[124..]
    ));
    vec.push(tv1);

    // #7 Large S beyond the high bit checks (i.e. non-canonical representation)
    let tv1 = really_large_s().unwrap();
    info.append(format!(
        "| 7| ..{:} | ..{:} | >> L |   L   |   L   |    V   |    V     |  |\n",
        &hex::encode(&tv1.message)[60..],
        &hex::encode(&tv1.signature)[124..]
    ));
    vec.push(tv1);

    // #8-9 Non canonical R
    let mut tv_vec = non_zero_small_non_canonical_mixed().unwrap();
    assert!(tv_vec.len() == 2);
    info.append(format!("| 8| ..{:} | ..{:} |  < L | mixed | small*|    V   |    V     | non-canonical R, reduced for hash |\n", &hex::encode(&tv_vec[0].message)[60..], &hex::encode(&tv_vec[0].signature)[124..]));
    info.append(format!("| 9| ..{:} | ..{:} |  < L | mixed | small*|    V   |    V     | non-canonical R, not reduced for hash |\n", &hex::encode(&tv_vec[1].message)[60..], &hex::encode(&tv_vec[1].signature)[124..]));
    vec.append(&mut tv_vec);

    // #10-11 Non canonical A
    let mut tv_vec = non_zero_mixed_small_non_canonical().unwrap();
    assert!(tv_vec.len() == 2);
    info.append(format!("|10| ..{:} | ..{:} |  < L | small*| mixed |    V   |    V     | non-canonical A, reduced for hash |\n", &hex::encode(&tv_vec[0].message)[60..], &hex::encode(&tv_vec[0].signature)[124..]));
    info.append(format!("|11| ..{:} | ..{:} |  < L | small*| mixed |    V   |    V     | non-canonical A, not reduced for hash |\n", &hex::encode(&tv_vec[1].message)[60..], &hex::encode(&tv_vec[1].signature)[124..]));
    vec.append(&mut tv_vec);

    // print!("{}", info.string().unwrap());

    vec
}