コード例 #1
0
        public string PartA()
        {
            EncryptionBreaker breaker = new EncryptionBreaker(DoorPublic, CardPublic);
            long encryptionKey        = breaker.CrackEncryptionKey();

            return(encryptionKey.ToString());
        }
コード例 #2
0
        public void EncryptionBreaker_CrackEncryptionKey()
        {
            long doorPublic = 17807724;
            long cardPublic = 5764801;
            var  sut        = new EncryptionBreaker(doorPublic, cardPublic);
            var  result     = sut.CrackEncryptionKey();

            Assert.Equal(14897079, result);
        }
コード例 #3
0
        public void EncryptionBreaker_FindLoopResults()
        {
            long doorPublic = 17807724;
            long cardPublic = 5764801;
            var  sut        = new EncryptionBreaker(doorPublic, cardPublic);
            var  result     = sut.FindLoopResults();

            Assert.Equal(8, result.CardLoopSize);
            Assert.Equal(11, result.DoorLoopSize);
        }
コード例 #4
0
        public void EncryptionBreaker_TransformNumber()
        {
            long doorPublic = 17807724;
            long cardPublic = 5764801;
            var  sut        = new EncryptionBreaker(doorPublic, cardPublic);

            var cardResult = sut.TransformNumber(8, 7);

            Assert.Equal(cardPublic, cardResult);

            var doorResult = sut.TransformNumber(11, 7);

            Assert.Equal(doorPublic, doorResult);
        }