從空格(ASCII碼32)到~(ASCII碼126)。表內(nèi)的第一行與表頭相同,下面的每一行都與上一行的內(nèi)容相同,只是字符相左移動(dòng)了一個(gè)位置。這樣,下一行的最后一個(gè)字符與上一行的第一個(gè)字符相同。
為了進(jìn)行文本編碼,可以任意選擇一個(gè)字符串,稱之為編碼字符串,也就是常說(shuō)的密鑰。為解釋編碼方法,我們假設(shè)密鑰是Walrus,待編碼的文本(即常說(shuō)的明文)是:
Meet me in St. Louis
我們?cè)诖幋a的文本之上重復(fù)書寫上述密鑰,使得其長(zhǎng)度與待編碼文本相同:
WalrusWalrusWalrusWa
Meet me in St. Louis
從上述兩行文本中按列對(duì)應(yīng)方式依次提取一個(gè)字符,可得到多個(gè)字符對(duì):WM、ae、le等,這些字符對(duì)可用作上表的索引。這樣,依次以這些字符對(duì)作為索引可從上表查到一系列字符,這些字符就構(gòu)成了文本編碼,即常說(shuō)的密文。例如,第W行第M列隊(duì)?wèi)?yīng)得字符是%,因此編碼的第一個(gè)字符就是%;第a行第e列對(duì)應(yīng)的字符是G;第l行第e列對(duì)應(yīng)的是R。依次進(jìn)行上述查找操作,可以得到完整的密文
%Grgua=aVauGLol?eiAU
進(jìn)行相反的操作就可對(duì)該文本解碼。
編寫編碼/解碼程序,可以對(duì)文本文件或鍵盤輸入的字符串進(jìn)行編碼/解碼,在選擇編碼解碼后,需要提示用戶輸入密鑰。
This document describes the MPI and MPI standards They are both extensions
to the MPI standard The MPI part of the document contains clarications and
corrections to the MPI standard and denes MPI The MPI part of the document
describes additions to the MPI standard and denes MPI These include miscellaneous
topics process creation and management onesided communications extended collective
operations external interfaces IO and additional language bindings