Ejemplo n.º 1
0
    def testFileHashMatchesKnownFile(self):
        """Tests that hasher matches the hash of a known file."""
        expected_sha256 = (
            'a9c0220b1dadd1812fc4bbe137f495d2c3b88c7b33b5a4de545d201fd31b3bc0')

        hasher = sha256.SHA256Hasher()
        self._AssertTestPathStringDigestMatch(hasher, ['ímynd.dd'],
                                              expected_sha256)

        hasher = sha256.SHA256Hasher()
        self._AssertTestPathBinaryDigestMatch(hasher, ['ímynd.dd'],
                                              expected_sha256.decode('hex'))
Ejemplo n.º 2
0
    def testFileHashMatchesEmptyFile(self):
        """Tests that hasher matches the hash of an empty file."""
        expected_sha256 = (
            'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')

        hasher = sha256.SHA256Hasher()
        self._AssertTestPathStringDigestMatch(hasher, ['empty_file'],
                                              expected_sha256)

        hasher = sha256.SHA256Hasher()
        self._AssertTestPathBinaryDigestMatch(hasher, ['empty_file'],
                                              expected_sha256.decode('hex'))