示例#1
0
        public void AESDecryptTest()
        {
            var Aes   = Convert.ToBase64String(AesHelper.AESEncrypt("qwesseeed", "12345678123456781234567812345678", "1234567812345678"));
            var DeAes = AesHelper.AESDecrypt(Aes, "12345678123456781234567812345678", "1234567812345678");

            Assert.IsTrue(DeAes.Length > 0);
        }
示例#2
0
        static void Main(string[] args)
        {
            byte[] inputByteArray = Encoding.UTF8.GetBytes("1升等于多少斤");

            var _Aes = AesHelper.AESEncrypt(inputByteArray, Key, IV);

            string a = Convert.ToBase64String(_Aes);

            Console.WriteLine("SnowflakeHelper.NextId:" + SnowflakeHelper.NextId());

            Console.WriteLine(a);

            string _aes = StringHelper.byteToHexStr(_Aes);

            Console.WriteLine(StringHelper.byteToHexStr(_Aes));

            byte[] by = StringHelper.HexToByte(_aes);

            Console.WriteLine(Encoding.UTF8.GetString(AesHelper.AESDecrypt(by, Key, IV)));

            Console.WriteLine(AesHelper.AESDecryptHex(_aes, Key, IV));

            //for (long i = 0; i < long.MaxValue; i++)
            //{
            //Console.WriteLine("ObjectId.NewId:" + ObjectIdInt.NewId());
            //}
            //for (long i = 0; i < long.MaxValue; i++)
            //{
            //    Console.WriteLine("ObjectId.GenerateNewStringId:" + ObjectId.NewId());
            //}

            //for (long i = 0; i < 1000; i++)
            //{
            //    Console.WriteLine("TimestampId.GetInstance1:" + TimestampId.Instance.GetId());
            //    Console.WriteLine("TimestampId.GetInstance2:" + TimestampId.Instance.GetId());
            //    Console.WriteLine("TimestampId.GetInstance3:" + TimestampId.Instance.GetId());
            //    Console.WriteLine("TimestampId.GetInstance4:" + TimestampId.Instance.GetId());
            //}
            Console.WriteLine("Hello World!");
        }
示例#3
0
 public byte[] Protect(byte[] plaintext)
 {
     return(AesHelper.AESEncrypt(plaintext, AesHelper.Key, AesHelper.IV));
 }
示例#4
0
        public void AESEncryptTest()
        {
            var aes = AesHelper.AESEncrypt("qwesseeed", "12345678123456781234567812345678", "1234567812345678");

            Assert.IsTrue(aes.Length > 0);
        }