Ask Your Question
0

The sage example in Crypto (Stallings)

asked 2013-05-10 06:24:40 -0500

Aye gravatar image

When I doing the exercise of the textbook in Append -C I confront a question, it says " Write a function that takes a bitlength n and generates a modulus N of bitlength n and g less than N and relatively prime to it. "

I am confused about the meaning

does is mean that I have to use the bitlength n and generate the modulus N? ( len(bin(n)) % N)?

edit retag flag offensive close merge delete

Comments

Could you give the precise reference of the exercise in appendix C ?

vdelecroix gravatar imagevdelecroix ( 2013-05-11 08:18:47 -0500 )edit

I got it... exercise 11.1 in the 5th edition.

vdelecroix gravatar imagevdelecroix ( 2013-05-11 08:22:29 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-05-11 08:32:27 -0500

You need to output a couple (N,g) where N is an integer whose bitlength is n (in other words it has n digits in base 2) and g is an integer relatively prime to N. I guess that your N should be a product of two primes p and q as in the description above. You may use the function random_prime of Sage for that purpose.

I confess that I do not understand this first question as it is not used in the next items...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-10 06:24:40 -0500

Seen: 117 times

Last updated: May 11 '13