치환암호 편집하기
최신판 | 당신의 편집 | ||
64번째 줄: | 64번째 줄: | ||
A-Z를 0~25의 수로 바꾸고, 26으로 나누어 나머지를 구하는 방법이면 대수학으로 설명된다. 열쇠로 K를 사용하는 비즈네르암호 E는 이렇게 쓸 수 있다. | A-Z를 0~25의 수로 바꾸고, 26으로 나누어 나머지를 구하는 방법이면 대수학으로 설명된다. 열쇠로 K를 사용하는 비즈네르암호 E는 이렇게 쓸 수 있다. | ||
− | + | <math>C_i=E_k(M_i)=(M_i+K_i)\,\bmod\,26</math> | |
복호화 D는 | 복호화 D는 | ||
− | + | <math>M_i=D_i(C_i)=(C_i-K_i)\,\bmod\,26</math> | |
여기서 <math>M_1...M_n</math>은 평문이고, <math>C=C_1...Cn</math>은 암호문이다. <math>K=K_1...K_n</math>은 열쇠를 <math>[n/m]</math>만큼 반복해서 얻는다. 여기서 n은 평문의 길이이고, m은 열쇠의 길이다. 예를 들어 평문 <math>M_i</math>가 T이고, 열쇠 <math>K_i</math>가 E이면 각각 <math> {\displaystyle T{\widehat {=}}19}</math>와 <math>{\displaystyle E{\widehat {=}}4}</math>이다. 계산하면 | 여기서 <math>M_1...M_n</math>은 평문이고, <math>C=C_1...Cn</math>은 암호문이다. <math>K=K_1...K_n</math>은 열쇠를 <math>[n/m]</math>만큼 반복해서 얻는다. 여기서 n은 평문의 길이이고, m은 열쇠의 길이다. 예를 들어 평문 <math>M_i</math>가 T이고, 열쇠 <math>K_i</math>가 E이면 각각 <math> {\displaystyle T{\widehat {=}}19}</math>와 <math>{\displaystyle E{\widehat {=}}4}</math>이다. 계산하면 | ||
− | + | <math>23=(19+4)\,\bmod\,26</math> | |
그러므로 암호문 <math>C_i</math>는 <math> {\displaystyle X{\widehat {=}}23}</math>이다. 복호화 암호문 <math>C_i</math>인 <math>{\displaystyle X{\widehat {=}}23}</math>에서 열쇠 <math>K_i</math>인 <math>{\displaystyle E{\widehat {=}}4}</math>를 빼면 | 그러므로 암호문 <math>C_i</math>는 <math> {\displaystyle X{\widehat {=}}23}</math>이다. 복호화 암호문 <math>C_i</math>인 <math>{\displaystyle X{\widehat {=}}23}</math>에서 열쇠 <math>K_i</math>인 <math>{\displaystyle E{\widehat {=}}4}</math>를 빼면 | ||
− | + | <math>19=(23-4)\,\bmod\,26</math> | |
로 다시 평문 <math>M_i</math>인 <math>{\displaystyle T{\widehat {=}}19}</math>를 얻을 수 있다. | 로 다시 평문 <math>M_i</math>인 <math>{\displaystyle T{\widehat {=}}19}</math>를 얻을 수 있다. |