Example #1
0
        protected override BitArray Calculate(int dataIndex, BitArray op)
        {
            PSData sBox = Parser.PermuteSBoxStorage.SBox[dataIndex];
            // 将op转为十进制
            int opInt     = Convert.ToInt32(BlockCipherUtil.BitArrayToString(op), 2);
            int resultInt = sBox.Data[opInt];
            // 将temp转为二进制字符串
            StringBuilder resultStr = new StringBuilder(Convert.ToString(resultInt, 2));

            for (int i = resultStr.Length; i < sBox.OutputLength; i++)
            {
                resultStr.Insert(0, "0");
            }
            BitArray result = BlockCipherUtil.StringToBitArray(resultStr.ToString());

            return(result);
        }
Example #2
0
 public string GetKey()
 {
     return(BlockCipherUtil.BitArrayToString(VariableStorage["key"]));
 }
Example #3
0
 public string GetState()
 {
     return(BlockCipherUtil.BitArrayToString(VariableStorage["state"]));
 }