示例#1
0
void bn254_fp2_xi_mul_inv(Element z, const Element x)
{
    Element* t = field(z)->base->tmp;

    bn254_fp_add(t[0], rep0(x), rep1(x));
    bn254_fp_sub(t[1], rep1(x), rep0(x));

    bn254_fp_set(rep0(z), t[0]);
    bn254_fp_set(rep1(z), t[1]);
}
示例#2
0
void bn254_fp2_xi_mul(Element z, const Element x)
{
    Element* t = field(z)->base->tmp;

    if (strcmp(x->field->field_name, "bn254_fp2a") == 0)
    {
        bn254_fp_add(t[0], rep1(x), rep1(x));
        bn254_fp_add(t[0], t[0], t[0]);
        bn254_fp_add(t[0], t[0], rep1(x));
        bn254_fp_set(rep1(z), rep0(x));
        bn254_fp_neg(rep0(z), t[0]);
    }

    if (strcmp(x->field->field_name, "bn254_fp2b") == 0)
    {
        bn254_fp_sub(t[0], rep0(x), rep1(x));
        bn254_fp_add(t[1], rep0(x), rep1(x));
        bn254_fp_set(rep0(z), t[0]);
        bn254_fp_set(rep1(z), t[1]);
    }
}
示例#3
0
void bn254_fp2_set_fp(Element z, const Element x, const Element y)
{
    bn254_fp_set(rep0(z), x);
    bn254_fp_set(rep1(z), y);
}
示例#4
0
void bn254_fp2_set(Element x, const Element y)
{
    bn254_fp_set(rep0(x), rep0(y));
    bn254_fp_set(rep1(x), rep1(y));
}
示例#5
0
void bn254_fp2_conj(Element z, const Element x)
{
    bn254_fp_set(rep0(z), rep0(x));
    bn254_fp_neg(rep1(z), rep1(x));
}
示例#6
0
void bn254_fp2_add_one(Element z, const Element x)
{
    bn254_fp_add_one(rep0(z), rep0(x));
    bn254_fp_set(rep1(z), rep1(x));
}