Here are some practical hints for doing the exercises ===================================================== Week 1 ------ RotI = { 1 -> 5 , 2 -> 11 , 3 -> 13, 4 -> 6, 5 -> 12, 6 -> 7, 7 -> 4, 8 -> 17, 9 -> 22, 10 -> 26, 11 -> 14, 12 -> 20, 13 -> 15, 14 -> 23, 15 -> 25, 16 -> 8, 17 -> 24, 18 -> 21, 19 -> 19, 20 -> 16, 21 -> 1, 22 -> 9, 23 -> 2, 24 -> 18, 25 -> 3, 26 -> 10 } RotIinv = {5 -> 1, 11 -> 2, 13 -> 3, ... } lettercodes = Range[26] RefB = {1 -> 25, 25 -> 1, (2,18),(3,21),(4,8),(5,17),(6,19),(7,12), (9,16),(10,24),(11,14),(13,15),(20,26),(22,23)} EnigmaGuts = {1 -> 8, 8 -> 1, 2 -> 11, ... } Enigma1[x_, n_] := Mod[((Replace[Mod[x + n, 26, 1], EnigmaGuts]) - n), 26, 1] MapThread[Enigma1, {list1, list2}] Week 2 ------ plain = {1,3,4,23,9,2,12,8} cypher = {17,4,14,6,17,3,4,23,8,8,19,3,1,24,22,11,6,22,15} Bombe[plain_, cyfrag_, k_] := If[ Enigma1[plain[[1]], k] == cyfrag[[1]] && cyfrag[[1]] == plain[[1+1]] && ... , {"YES!!!",k} , {"no"} ] Week 3 ------ << FiniteFields` Week 4 ------ elliptic = ContourPlot[y^2 == x^3 - 5 x + 3, {x,-3,3},{y,-4,4},Axes->True] EllipticAdd[p_, a_, b_, c_, P_List, Q_List] := Module[{lam, x3, y3, P3}, Which[ P == {O}, R = Q, Q == {O}, R = P, P[[1]] != Q[[1]], lam = Mod[(Q[[2]] - P[[2]]) PowerMod[Q[[1]] - P[[1]], -1, p], p]; x3 = Mod[lam^2 - a - P[[1]] - Q[[1]], p]; y3 = Mod[-(lam (x3 - P[[1]]) + P[[2]]), p]; R = {x3, y3}, (P == Q) && (P != {O}), lam = Mod[(3*P[[1]]^2 + 2 a*P[[1]] + b) PowerMod[2 P[[2]], -1, p], p]; x3 = Mod[lam^2 - a - P[[1]] - Q[[1]], p]; y3 = Mod[-(lam (x3 - P[[1]]) + P[[2]]), p]; R = {x3, y3}, (P[[1]] == Q[[1]]) && (P[[2]] != Q[[2]]), R = {O} ]; R ] Z2mEllipticAdd[a_, c_, P_List, Q_List] := Module[{lam, x3, y3, P3,R}, Which[ P == {O}, R = Q, Q == {O}, R = P, ToElementCode[P[[1]]] != ToElementCode[Q[[1]]], lam = (Q[[2]] + P[[2]])/(Q[[1]] + P[[1]]); x3 = lam^2 + lam + a + P[[1]] + Q[[1]]; y3 = lam (x3 + P[[1]]) + x3 + P[[2]]; R = {x3, y3}, ((ToElementCode[P[[1]]] == ToElementCode[Q[[1]]]) && (ToElementCode[P[[2]]] == ToElementCode[Q[[2]]])) && (P != {O}), lam = P[[1]] + P[[2]]/P[[1]]; x3 = lam^2 + lam + a; y3 = P[[1]]^2 + (lam + 1) x3; R = {x3, y3}, (ToElementCode[P[[1]]] == ToElementCode[Q[[1]]]) && (ToElementCode[P[[2]]] != ToElementCode[Q[[2]]]), R = {O} ]; R ] P =.; a = ee; c = 0; P[0] = {x, y}; P[i_] := P[i] = Z2mEllipticAdd[a, c, P[i - 1], P[i - 1]]