importjava.util.Scanner;publicclassHillCipher{privateint[][]keyMatrix;// 生成密钥矩阵的方法publicvoidgenerateKeyMatrix(Stringkey){intlength=(int)Math.sqrt(key.length());keyMatrix=newint[length][length];intk=0;// 填充密钥矩阵for(inti=0;i<length;i++){for(intj=0;j<length;j++){keyMatrix[...
根据算法描述,是密钥矩阵与明文向量进行相乘 这里我们为了能够让明文向量与密钥矩阵相乘,不能张口就来。 比如直接来一个四维行向量(0,1,2,3),这相当于是一个4*1的矩阵,不能直接与提给的2*2的方阵进行乘法 我们需要对提给的明文进行分组 两个一组,这样我就有了两个列向量 (我也不知道为什么第二个图那么大...
two different reasonable candidate pairs donot result in a sensible plaintext.In any case, this extra credit question is time-consuming and entirely optional, so I recommend youleave it until the end.Practical hints The Hill cipher used here assumes that the character A maps to the number 0....