def test_flatlongfile(self): t = open(os.path.join(PATH,"long.bin.clear.trc"), "w") with open(os.path.join(PATH,"fixtures/long.bin"), 'r') as f: for l in f: t.write(l) t.close() # check encrypted file on disk did not change self.assertEquals('36209641806DB628D04F239192CD8E8C', hashfile(os.path.join(PATH,"long.bin.clear.trc"))) # check round trip t2 = Trace(os.path.join(PATH,"long.bin.clear.trc")) with open(os.path.join(PATH,"long.bin.clear.roundtrip"), 'w') as f: while True: data = t2.read(1024) if len(data) == 0: break f.write(data) # check decrypted file on disk same as original self.assertEquals('36209641806DB628D04F239192CD8E8C', hashfile(os.path.join(PATH,"long.bin.clear.roundtrip")))
def test_flattextfile(self): t = open(os.path.join(PATH,"text.txt.clear.trc"), "w") with open(os.path.join(PATH,"fixtures/text.txt"), 'r') as f: for l in f: t.write(l) t.close() # check encrypted file on disk did not change self.assertEquals('1F439C7547B1EF1C1D3085483A87AD2E', hashfile(os.path.join(PATH,"text.txt.clear.trc"))) # check round trip t2 = Trace(os.path.join(PATH,"text.txt.clear.trc")) with open(os.path.join(PATH,"text.txt.clear.roundtrip"), 'w') as f: while True: data = t2.read(1024) if len(data) == 0: break f.write(data) # check decrypted file on disk same as original self.assertEquals('1F439C7547B1EF1C1D3085483A87AD2E', hashfile(os.path.join(PATH,"text.txt.clear.roundtrip")))