第十一章       錯誤更正碼與公鑰密碼系統

pages 245 - 256

例題05

H = {{0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}, {1, 1, 1, 
            0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0}, 
{0, 1, 1, 
            1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0}, {1, 0, 1, 1, 1, 0, 1, 0, 1, 
            0, 1, 0, 0, 0, 1}};
y = {0, 0, 0, 0, 
          1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1};
s=Mod[y. Transpose[H],2]

L=Table[If[Transpose[H][[j]]==s,1,0],{j, 15}];
Position[L, 
          Max[L]][[1]][[1]]

Mod[y + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, 2]

ScientificForm[Binomial[1024.,50]]

ScientificForm[Binomial[1024. , 50]]

例題06

S = {{1, 0, 0, 1}, {1, 1, 0, 1}, {0, 1, 0, 1}, {1, 1, 1, 
            0}};
P = {{0, 0, 1, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 
            0}, {0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 1}, {0, 1, 0, 0, 0, 
            0, 0}, {0, 0, 0, 1, 0, 0, 0}};
G = {{1, 0, 0, 0, 1, 1, 0}, {0, 1, 0, 0, 1, 0, 1}, {0, 0, 1, 0, 0, 1, 
            1}, {0, 0, 0, 1, 1, 1, 1}};
G1 = Mod[S . G . P, 2]

x = {{1, 0, 1, 1}}; 
    e = {{0, 1, 0, 0, 0, 0, 0}};
y = Mod[x . G1 + e, 2]

y1 = Mod[y . Inverse[P], 2]

x1 = {{0, 0, 1, 0, 0, 1, 1}}; x0 = {Take[x1[[1]], 4]}

x = Mod[x0 . Inverse[S], 2]