Re: RE: Simplify a module
- To: mathgroup at smc.vnet.net
- Subject: [mg39509] Re: [mg39487] RE: Simplify a module
- From: Flip <flip at safebunch.com>
- Date: Thu, 20 Feb 2003 05:14:14 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Dr. Bob, the purpose of the exercise was to demonstrate two things: 1. The isomorphic properties of using the chinese remainder theorem, 2. To express the decryption exponent for RSA cryptography using the CRT The function takes a crypto system with p, q distinct primes and then creates a fuction d[e_] which is the "dectryption exponent" as a function of e. There are no inverses to take if one had such a fucntion. Give me any "e" and I can use it to calculate "d". This is not practical, but we wanted to let students think about both of these topics and it is rather amazing that CRT allows us to do this. Thanks for the inputs guys, I greatly appreciate your help. Flip --- Dr Bob <drbob at bigfoot.com> wrote: >I had left out the definition of 'mytab'. Sorry. > >Flip's function is apparently a generalized inverse modulo 3, 8 and 49. > >It satisfies the following tests: > >test[i_] := And @@ (Mod[#*f@#, i] == If[GCD[#, i] == 1, 1, 0] & /@ >Range[1176]) >test /@ {3, 8, 49} > >{True, True, True} > >Evaluate the following to see where the constants come from (I think): > >3*8*49 >{1176/#, PowerMod[1176/#, -1, #]} & /@ {3, 8, 49} >Times @@@ % >Mod[#, {3, 8, 49}] & /@ % > >The function can also be written as > >m = If[GCD[#1, #2] == 1, PowerMod[#1, -1, #2], 0] &; >f[e_] := Mod[784 m[e, 3] + 441 m[e, 8] + 1128 m[e, 49], 1176] > >Maybe Flip can clarify what the function is used for. > >Bobby > >On Wed, 19 Feb 2003 17:20:54 +0100, Wolf, Hartmut <Hartmut.Wolf@t- >systems.com> wrote: > >> Hey Bobby, >> >> try to evaluate the appending notebook. It works with me. A problem with >> mytab? (I didn't like to spend time on this thread). >> >> >>> -----Original Message----- >>> From: Dr Bob [mailto:drbob at bigfoot.com] To: mathgroup at smc.vnet.net >>> Sent: Wednesday, February 19, 2003 4:55 PM >>> To: Wolf, Hartmut; mathgroup at smc.vnet.net >>> Subject: [mg39509] Re: [mg39487] RE: Simplify a module >>> >>> >>> That doesn't work, at least not here on my computer: >>> >>> sw[{{a_, base_}, seq_}] := (a = Switch[Mod[e, base], >>> Evaluate[Sequence @@ seq], _, 0]) >>> dcalc4[ein_] := Block[{a1, a2, a3, e = ein}, {T1, M1, T2, M2, T3, M3} = >>> {2, 392, 3, 147, 47, 24}; >>> Evaluate[sw /@ mytab]; >>> Mod[a1*T1*M1 + a2*T2*M2 + a3*T3*M3, 1176]] >>> dcalc4[5] >>> >>> Mod[784 a1 + 441 a2 + 1128 a3, 1176] >>> >>> For simplicity, I like this one: >>> >>> m = If[Mod[#, 7] == 0, 0, PowerMod[#, -1, 49]] & /@ Range[0, 48]; >>> f[e_] := Mod[784Mod[e, 3] + 441Mod[e, 8]Mod[e, 2] + 1128 m[[1 + Mod[e, >>> 49]]], 1176] >> >> Yes, something to the like, my instinct told me. Yet I didn't like to >> delve >> into that. And not dwell on this. What I wanted to show was (1) a trick >> as >> to get at the relevant data from Flips code (2) How to seperate data from >> code and (3) that Switch[...] expr. Finis. >> >> Perhaps you can better see what Flip's doing. These Numbers 784, 1176 ... >> are a mystery to me. >> >>> f[5] >>> >>> 941 >>> >>> I was interested in versions of your solution for other reasons. >>> >>> Bobby >>> >> >> Sure, Bobby, this was meant for Flip! >> >> Yours, >> Hartmut >> >> > > > >-- >majort at cox-internet.com >Bobby R. Treat _____________________________________________________________ Visit our web directory and reference library at http://safebunch.com. Get FREE email for life at ---> http://safebunch.com _____________________________________________________________ Select your own custom email address for FREE! Get you at yourchoice.com w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag