aboutsummaryrefslogtreecommitdiffstats
path: root/mageiaSync
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2020-07-25 14:07:03 +0200
committerPapoteur <papoteur@mageia.org>2020-07-25 14:07:03 +0200
commitdec91689feeb45ebbf42517b3f01919bcd577e54 (patch)
treee4bba9f965537128adb3ba62a631c3aa50b8eb48 /mageiaSync
parentf7cdda1536ad571bbe26ab7498f7476b6b43627a (diff)
downloadMageiaSync-dec91689feeb45ebbf42517b3f01919bcd577e54.tar
MageiaSync-dec91689feeb45ebbf42517b3f01919bcd577e54.tar.gz
MageiaSync-dec91689feeb45ebbf42517b3f01919bcd577e54.tar.bz2
MageiaSync-dec91689feeb45ebbf42517b3f01919bcd577e54.tar.xz
MageiaSync-dec91689feeb45ebbf42517b3f01919bcd577e54.zip
Compute and check SHA3-512 sum instead of SHA512
Diffstat (limited to 'mageiaSync')
-rw-r--r--mageiaSync/mageiaSyncExt.py12
-rw-r--r--mageiaSync/mageiasync.py14
2 files changed, 13 insertions, 13 deletions
diff --git a/mageiaSync/mageiaSyncExt.py b/mageiaSync/mageiaSyncExt.py
index ff4ebaa..37db330 100644
--- a/mageiaSync/mageiaSyncExt.py
+++ b/mageiaSync/mageiaSyncExt.py
@@ -11,7 +11,7 @@ from subprocess import Popen, PIPE
from PyQt5.QtCore import QDir, QFileInfo,pyqtSignal,QThread
class checkThread(QThread):
- sha512Signal= pyqtSignal(int)
+ sha3Signal= pyqtSignal(int)
dateSignal=pyqtSignal(int)
sizeFinalSignal=pyqtSignal(int,str)
checkStartSignal=pyqtSignal(int)
@@ -22,8 +22,8 @@ class checkThread(QThread):
def processSum(self,sumType):
import hashlib
checkvalue=0
- if sumType=='sha512':
- hashfunc = hashlib.sha512()
+ if sumType=='sha3':
+ hashfunc = hashlib.sha3_512()
# Check if the sum file has a valid signature
gpg = gnupg.GPG()
gpg.encoding = 'utf-8'
@@ -58,7 +58,7 @@ class checkThread(QThread):
except:
return checkvalue
sumcheck=(fs.readline()).split()[0]
- if sumcalc==sumcheck:
+ if sumcalc.upper()==sumcheck:
checkvalue += 128
return checkvalue
@@ -74,8 +74,8 @@ class checkThread(QThread):
self.sizeFinalSignal.emit(signal, '{:,}'.format(isoSize).replace(',',' '))
signal=300+self.isoIndex
self.checkStartSignal.emit(signal)
- checkSha=self.processSum('sha512')
- self.sha512Signal.emit(self.isoIndex+checkSha)
+ checkSha=self.processSum('sha3')
+ self.sha3Signal.emit(self.isoIndex+checkSha)
self.quit()
diff --git a/mageiaSync/mageiasync.py b/mageiaSync/mageiasync.py
index 82e7d83..dccdf48 100644
--- a/mageiaSync/mageiasync.py
+++ b/mageiaSync/mageiasync.py
@@ -127,7 +127,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
# Model for local list view in a table
self.model = QStandardItemModel(0, 4, self)
- headers=[self.tr("Directory"),self.tr("Name"),self.tr("Size"),"SHA512"]
+ headers=[self.tr("Directory"),self.tr("Name"),self.tr("Size"),"SHA3-512"]
i=0
for label in headers:
self.model.setHeaderData(i, QtCore.Qt.Horizontal,label )
@@ -242,7 +242,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
self.model.data(self.model.index(isoIndex,0)) ,
self.model.data(self.model.index(isoIndex,1)),
isoIndex)
- self.checkThreads[-1].sha512Signal.connect(self.sha512Check)
+ self.checkThreads[-1].sha3Signal.connect(self.sha3Check)
# self.checkThreads[-1].dateSignal.connect(self.dateCheck)
self.checkThreads[-1].sizeFinalSignal.connect(self.sizeUpdate)
self.checkThreads[-1].checkStartSignal.connect(self.checkStart)
@@ -255,7 +255,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
row=isoIndex-col*100
self.model.setData(self.model.index(row, col, QtCore.QModelIndex()), self.tr("Checking"))
- def sha512Check(self,check):
+ def sha3Check(self,check):
verified=False
signed=True
if check>=128:
@@ -278,10 +278,10 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
row-=32
print(row)
if not signed:
- self.lvMessage("Signature for %s.sha512 not found"%self.model.data(self.model.index(row,1)))
+ self.lvMessage("Signature for %s.sha3 not found"%self.model.data(self.model.index(row,1)))
if verified:
# we add an icon for the GPG key
- self.lvMessage("Sha512 signature OK")
+ self.lvMessage("Sha3 signature OK")
self.model.setData(self.model.index(row, 3, QtCore.QModelIndex()),QIcon("preflight-verifier"),1)
self.model.setData(self.model.index(row, 3, QtCore.QModelIndex()), val)
@@ -374,7 +374,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
self.localDirLabel.setText(self.tr("Local directory: ")+self.destination)
else:
#; {} is the placeholder the directory anme
- self.localDirLabel.setText(self.tr("/!\ Local directory {} doesn't exists or isn't accessible. Check mounts or settings.").format(self.destination))
+ self.localDirLabel.setText("/!\\ "+self.tr("Local directory {} doesn't exists or isn't accessible. Check mounts or settings.").format(self.destination))
if self.location !="":
self.remoteDirLabel.setText(self.tr("Remote directory: ")+self.location)
@@ -504,7 +504,7 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow):
def launchSync(self):
dest = QFileInfo(self.destination)
if (not dest.exists()) or (not dest.isDir()):
- self.lvMessage(self.tr("/!\ Local directory {} doesn't exists or isn't accessible. Check mounts or settings.").format(self.destination))
+ self.lvMessage("/!\\ " + self.tr("Local directory {} doesn't exists or isn't accessible. Check mounts or settings.").format(self.destination))
return
if not dest.isWritable():
self.lvMessage(self.tr("/!\ Local directory {} isn't writable"))