Exemplo n.º 1
0
    def selectFile(self):
        dialog = QtGui.QFileDialog
        fileDialog = dialog.getOpenFileName(Form)
        filePathP = self.filePath.setText(fileDialog)

        f = open(fileDialog, 'r')
        now = time.time()
        with f:
            data = f.read()
            l = len(data)
            for i in data:
                key = SimpleXOR.rand(l)
            xor = SimpleXOR.xor_en(data, ke=key)

            self.Original_text.setText(data)
            self.Key_text.setText(key)
            self.encrypted_text.setText(xor)

            nowTime = 'Process took %s s' % str(time.time() - now)
            self.time.setText(nowTime)

            charCount = "There are %s characters in the original file" % l
            self.originalCharCount.setText(charCount)

        f.close()
    def selectFile(self):
        dialog = QtGui.QFileDialog
        fileDialog = dialog.getOpenFileName(Form)
        filePathP = self.filePath.setText(fileDialog)

        f = open(fileDialog, "r")
        now = time.time()
        with f:
            data = f.read()
            l = len(data)
            for i in data:
                key = SimpleXOR.rand(l)
            xor = SimpleXOR.xor_en(data, ke=key)

            self.Original_text.setText(data)
            self.Key_text.setText(key)
            self.encrypted_text.setText(xor)

            nowTime = "Process took %s s" % str(time.time() - now)
            self.time.setText(nowTime)

            charCount = "There are %s characters in the original file" % l
            self.originalCharCount.setText(charCount)

        f.close()