WIP: working on the reading of picseal image files
This commit is contained in:
parent
9e403dc268
commit
1fea208349
|
@ -25,7 +25,14 @@ from libs.jpg_fp import JpgFingerprint
|
|||
#
|
||||
class JpgBin:
|
||||
|
||||
BUF_CHUNK_SIZE = 2048
|
||||
BUF_CHUNK_SIZE = 8192
|
||||
|
||||
soi_marker = b'\xff\xd8'
|
||||
eof_marker = b'\xff\xd9'
|
||||
app15_marker = b'\xff\xef'
|
||||
# ascii code for "picseal"
|
||||
picseal_marker = b'\x70\x69\x63\x73\x65\x61\x6C'
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.data_buf = None
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#
|
||||
#
|
||||
#
|
||||
from libs.jpg_bin import JpgBin
|
||||
|
||||
|
||||
class JpgBinWrite:
|
||||
|
||||
soi_marker = b'\xff\xd8'
|
||||
eof_marker = b'\xff\xd9'
|
||||
picseal_marker = b'\xff\xef'
|
||||
# picseal_marker = b'\xff\xe0'
|
||||
|
||||
|
||||
#
|
||||
def __init__(self, jpg_in, jpg_out):
|
||||
self.fhr = jpg_in
|
||||
|
@ -41,8 +40,10 @@ class JpgBinWrite:
|
|||
size += len(crypto_sig.hash_data)
|
||||
size += len(keyder)
|
||||
|
||||
# write app marker
|
||||
self.fhw.write(JpgBin.app15_marker)
|
||||
# write picseal marker
|
||||
self.fhw.write(JpgBinWrite.picseal_marker)
|
||||
self.fhw.write(JpgBin.picseal_marker)
|
||||
# write the size of picseal record
|
||||
self.fhw.write(size.to_bytes(2, byteorder='big'))
|
||||
# write hash of image
|
||||
|
@ -84,8 +85,8 @@ class JpgBinWrite:
|
|||
|
||||
#
|
||||
def __writeJpgHeader(self):
|
||||
self.fhw.write(bytes(JpgBinWrite.soi_marker))
|
||||
self.fhw.write(bytes(JpgBin.soi_marker))
|
||||
|
||||
#
|
||||
def __writeJpgFooter(self):
|
||||
self.fhw.write(bytes(JpgBinWrite.eof_marker))
|
||||
self.fhw.write(bytes(JpgBin.eof_marker))
|
||||
|
|
Loading…
Reference in New Issue