Ask Your Question

Sri1729's profile - activity

2021-01-21 11:50:33 +0100 asked a question Which hash function can be used to get $w=H(d)\in F^n$ case?

I am trying to implement a cryptographic scheme. For a arbitrary message $d$ , I need a Hash Function $\mathbb{H}$ that can compute the hash value $w=\mathbb{H}(d)\in \mathbb{F}^n$. Here $F$ is a finite field of order four.

I can not find any hash function which outputs field values.

Can someone please help and show me the right direction?

2021-01-19 10:57:55 +0100 commented answer Multiply polynomials from different rings

Don't have words to thank you. I spent a lot of time on this but still was not able to think about it. Have a good day :)

2021-01-19 10:36:55 +0100 asked a question Multiply polynomials from different rings

Suppose I take a polynomial from $K[x]$, say $x^2 + 5x$, and another polynomial from $K[y]$, say $y^3$. I want to formally multiply them and get $x^2y^3 + 5xy^3$ as the output.

How can I do that?

Note: K is the finite field of size 4 in a.

My efforts:

sage: K.<a> = FiniteField(4)

sage: R_1 = PolynomialRing(K, ['z%s' % p for p in range(1, 3)])
sage: R_2 = PolynomialRing(K, ['x%s' % p for p in range(1, 3)])

sage: pp = R_1.random_element()
sage: pp
(a + 1)*z1^2 + (a)*z1*z2 + (a + 1)*z2 + (a)

sage: qq = R_2.random_element()
sage: qq
x1*x2 + (a + 1)*x2^2 + x1 + 1

When I do pp*qq I get the following output

unsupported operand parent(s) for *: 'Multivariate Polynomial Ring
in z1, z2 over Finite Field in a of size 2^2' and 'Multivariate Polynomial
Ring in x1, x2 over Finite Field in a of size 2^2'
2021-01-19 10:23:59 +0100 received badge  Scholar (source)
2021-01-19 10:23:47 +0100 received badge  Supporter (source)
2021-01-19 09:18:54 +0100 received badge  Student (source)
2021-01-19 07:00:12 +0100 asked a question Random polynomial of degree 1

Having defined

  • the finite field K of size 4 in a
  • a polynomial ring R1 over K

one can ask for a random element using the random_element method.

The random polynomial I obtained that way was of degree two:

sage: K.<a> = FiniteField(4)
sage: R1 = PolynomialRing(K, ['z%s' % p for p in range(1, 3)])
sage: R1.random_element()
(a)*z1*z2 + (a + 1)*z2^2 + z1 + (a)*z2

If I only want a random linear polynomial from this ring, how can I get one?

2021-01-10 09:38:56 +0100 asked a question Not able to generate a simple list of polynomial. I am getting list of list.
 def quad_polynomial(field, n,m):
    Polynomial_Ring1=PolynomialRing(K,['x%s'%p for p in range(1,n+1)])
    gen_Polynomial_Ring1 = matrix(x1)
    list_of_quadratic_part=[0 for i in range(m)]
    for i in range(m):

    return list_of_quadratic_part

The output I am getting is like this:

[[x1*x2 + (a + 1)*x2^2], [x1^2 + (a + 1)*x1*x2], [x1^2 + (a + 1)*x2^2]]

It is giving me list of list. I want a output like

 [x1*x2 + (a + 1)*x2^2, x1^2 + (a + 1)*x1*x2, x1^2 + (a + 1)*x2^2]

How can I do it?