axiom-mail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-mail] Re: [Axiom-developer] Changing a variable type?


From: Alasdair McAndrew
Subject: [Axiom-mail] Re: [Axiom-developer] Changing a variable type?
Date: Thu, 24 May 2007 17:07:01 +1000

Here's my attempts at the Chor-Rivest cryptosystem (an exercise in the use of finite fields):

p:=7   -- these are the values used in the example in "Handbook of Applied Cryptography" by Menezes at al
h:=4
f:POLY(PF p):=x^h+reduce(+,[(random(p-1)+1)*x^(i-1) for i in 0..p-1]) -- create a random monic polynomial of degree h
irreducible?(f)  -- test and repeat last two lines until "true"
F:=FFP(PF p,f)
x:=generator()$F
g:=random()$F;primitive?(g) -- repeat until "true"
d:=random(size()$F-2)
a:=[discreteLog(g,x+i) for i in 0..p-1]
c:=[(a.i+d)::ZMOD(size()$F-1) for i in 1..p] -- this is the public key
message:=[1,0,1,1,0,0,1]  -- each message block is of length p and must contain h zeros
ct:=reduce(+,[message.i*c.i for i in 1..p])::ZMOD(size()$F-1)  -- this number is the ciphertext
r:=ct-d*(dimension()$F::NNI)::ZMOD(ord)
u:=g^convert(r)

And now, this is the problem: to complete the decryption we have to solve u+f over PF(p) - this can be done by simply evaluating u+f for all values of PF(p).  But u and f are two different types...  where do I go from here?

Thanks,
Alasdair

On 23 May 2007 15:58:21 +0200, Martin Rubey <address@hidden> wrote:
Dear Alasdair,

(redirecting to axiom-math, where usage questions belong)

"Alasdair McAndrew" <address@hidden> writes:

> In experimenting with the Chor-Rivest knapsack cryptosystem, I have the
> problem of adding two polynomials: one is the defining polynomial of the
> field, and the other is a field element.
>
> But the command
>
> definingPolynomial()$F+u

could you just send me the definition of F? (i.e., code)

Martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]