Ejemplo n.º 1
0
        public static void main()
        {
            byte[] sourcePath = new byte[] {
                0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
            };
            SM4Utils sm4 = new SM4Utils();

            sm4.secretKey = "0123456789abcdeffedcba9876543210";
            sm4.hexString = true;
            byte[] ciphertext = sm4.encryptECB(sm4.secretKey, false, sourcePath);
            Console.WriteLine(BitConverter.ToString(ciphertext));
            byte[] plaintext = sm4.decryptECB(sm4.secretKey, false, ciphertext);
            Console.WriteLine(BitConverter.ToString(plaintext));
        }