#7124: affine cipher and its cryptanalysis
----------------------------+-----------------------------------------------
Reporter: mvngu | Owner: somebody
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.2
Component: cryptography | Keywords: affine cipher
Work_issues: | Author: Minh Van Nguyen
Reviewer: | Merged:
----------------------------+-----------------------------------------------
Changes (by rbeezer):
* status: needs_review => needs_work
Comment:
Hi Minh,
Two comments:
1. I think {{{inverse_key()}}} is broken. The constant term is always
identical, for example, run
{{{x=S.random_key(); print x, S.inverse_key(*x)}}}
repeatedly.
This shouldn't happen even for a=1 as is written in the doctests, since
when a=1 it is a shift system. For testing, the inverse of (a,b)=(5,7)
should be (21,9). You can test this by enchipering with one key and
deciphering with the other, results should be the same (this might be good
thing to do in the doctests).
Maybe you just need subtraction someplace where you have a addition, or...
2. Would it make sense to build the list {{{A}}} of invertible linear
coefficients in the {{{brute_force}}} method as part of {{{__init__}}} for
the cryptosystem? Then you could skip some of the gcd-stuff. For example
when building a random key, you could just grab a linear coefficient,
instead of repeatedly testing. Or when checking validity for a new key,
you could just test on the list. Done right, the generation of {{{A}}}
could easily generalize to a new alphabet length for a new monoid as the
alphabet.
Rob
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7124#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---