Example #1
0
        public void HasherCanCorrectlyGenerate64ByteMediumFileHash()
        {
            ArchivialLibrary.Crypto.Hasher h = new ArchivialLibrary.Crypto.Hasher(new MockLogger());

            byte[] actualHash   = h.Generate64ByteFileHash(".\\TestFiles\\Hasher\\MediumFile.mp3");
            byte[] expectedHash = { 234,  71, 228, 136, 179, 247, 148, 228,  21,  49, 132, 155,
                                    219, 239, 173, 165, 249,  35, 144, 199, 224, 127, 103,
                                    207, 211, 205, 191,  43, 207, 232, 154, 191, 238,  13, 128,
                                    221,  58, 116,  68, 175, 197, 121, 110, 243,  35,  53, 228,
                                    214, 206, 251, 250, 253,  35, 149,  27, 127, 233, 201,  36,
                                    219, 107,  45, 136, 215 };

            Assert.IsTrue(h.CheckTwoByteHashesAreTheSame(actualHash, expectedHash));
        }
Example #2
0
        public void HasherCanCorrectlyGenerate64ByteSmallFileHash()
        {
            ArchivialLibrary.Crypto.Hasher h = new ArchivialLibrary.Crypto.Hasher(new MockLogger());

            byte[] actualHash   = h.Generate64ByteFileHash(".\\TestFiles\\Hasher\\SmallFile.txt");
            byte[] expectedHash = { 30,  175, 186, 169, 203, 212, 173, 146, 227,  20,  65,
                                    15,  115,  42, 115,  68,  95,   1, 236,  65, 180, 175, 251,
                                    135,  40, 244, 205, 140, 242, 222,   6,   7, 140,   4, 179,
                                    223, 179,  50, 151,  56, 251,  15, 145, 127, 204, 104,  72,
                                    5,   201, 129, 225, 249, 132, 172, 224, 172, 225, 206,
                                    164, 213, 166, 106,  49, 170 };

            Assert.IsTrue(h.CheckTwoByteHashesAreTheSame(actualHash, expectedHash));
        }