def generateSHA256(self, channelName, dt, logPath, theIP, link, outFile): f = file(outFile, 'rb') sha256 = hashlib.sha256() while True: data = f.read(2**20) if not data: break sha256.update(data) f.close() theSHA256 = sha256.hexdigest() theSize = os.path.getsize(outFile) txtlog.log(dt, self.txtlog_file, channelName + ' Downloaded: ' + link + ' - Saved: ' + outFile + ' - Size: ' + str(theSize) + ' - SHA256: ' + str(theSHA256)) txtlog.downloadLog(dt, logPath, theIP, link, outFile, theSize, theSHA256)
def generateMD5(self, channelName, dt, logPath, theIP, link, outFile): f = file(outFile, 'rb') md5 = hashlib.md5() while True: data = f.read(2**20) if not data: break md5.update(data) f.close() theMD5 = md5.hexdigest() theSize = os.path.getsize(outFile) txtlog.log(self.txtlog_file, channelName + ' Downloaded: ' + link + ' - Saved: ' + outFile + ' - Size: ' + str(theSize) + ' - MD5: ' + str(theMD5)) txtlog.downloadLog(dt, logPath, theIP, link, outFile, theSize, theMD5)