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

            byte[] actualHash   = h.Generate32ByteFileHash(".\\TestFiles\\Hasher\\MediumFile.mp3");
            byte[] expectedHash = { 59,  223, 174, 134,  63,  70, 226, 183, 168, 86, 148,
                                    117,  40, 147, 139, 169, 231,   2,  41,  38,  8, 109,55,
                                    221,   0,  10,  29, 173, 245,  93,  11, 59 };

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

            byte[] actualHash   = h.Generate32ByteFileHash(".\\TestFiles\\Hasher\\SmallFile.txt");
            byte[] expectedHash = { 105, 105, 114, 199,  90, 53,  52, 53, 173,  45,
                                    254, 222, 255, 128, 156, 96,  21, 79, 196,  31,
                                    4,   129, 237,  45,  93, 69, 246, 90,  61, 209,80, 64 };

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