コード例 #1
0
        public void HexToBase64()
        {
            // Arrange
            string base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_0";
            string hex    = "00108310518720928B30D38F41149351559761969B71D79F8218A39259A7A29AABB2DBAFC31CB3D35DB7E39EBBF3DFBF";

            // Act
            string retVal = MachineKeyCryptoSystem.HexToBase64(hex);

            // Assert
            Assert.Equal(base64, retVal);
        }
コード例 #2
0
        public void Base64ToHex_HexToBase64_RoundTrips()
        {
            for (int i = 0; i <= Byte.MaxValue; i++)
            {
                // Arrange
                string hex = String.Format("{0:X2}", i);

                // Act
                string retVal = MachineKeyCryptoSystem.Base64ToHex(MachineKeyCryptoSystem.HexToBase64(hex));

                // Assert
                Assert.Equal(hex, retVal);
            }
        }