Beispiel #1
0
 def _calculate_deskey(self, hashdata):
     prepad = 2
     hash = mssha1.new()
     for data in hashdata:
         if prepad > 0:
             data = ("\000" * prepad) + data
             prepad = 0
         postpad = 64 - (len(data) % 64)
         if postpad < 64:
             data = data + ("\000" * postpad)
         hash.update(data)
     digest = hash.digest()
     key = [0] * 8
     for i in xrange(0, len(digest)):
         key[i % 8] ^= ord(digest[i])
     return ''.join(chr(x) for x in key)
Beispiel #2
0
 def _calculate_deskey(self, hashdata):
     prepad = 2
     hash = mssha1.new()
     for data in hashdata:
         if prepad > 0:
             data = ("\000" * prepad) + data
             prepad = 0
         postpad = 64 - (len(data) % 64)
         if postpad < 64:
             data = data + ("\000" * postpad)
         hash.update(data)
     digest = hash.digest()
     key = [0] * 8
     for i in xrange(0, len(digest)):
         key[i % 8] ^= ord(digest[i])
     return ''.join(chr(x) for x in key)
Beispiel #3
0
 def _calculate_deskey(self, hashdata):
     prepad = 2
     hash = mssha1.new()
     for data in hashdata:
         if prepad > 0:
             data = (b"\000" * prepad) + data
             prepad = 0
         postpad = 64 - (len(data) % 64)
         if postpad < 64:
             data = data + (b"\000" * postpad)
         hash.update(data)
     digest = hash.digest()
     if not isinstance(digest, bytes):
         digest = digest.encode('ascii')
     digest = bytearray(digest)
     key = bytearray(8)
     for i, k in enumerate(digest):
         key[i % 8] ^= k
     return bytes(key)
Beispiel #4
0
 def calculate_deskey(self):
     hashfiles = ['/meta', '/DRMStorage/DRMSource']
     if self.drmlevel == 3:
         hashfiles.append('/DRMStorage/DRMBookplate')
     prepad = 2
     hash = mssha1.new()
     for name in hashfiles:
         data = self.get_file(name)
         if prepad > 0:
             data = ("\000" * prepad) + data
             prepad = 0
         postpad = 64 - (len(data) % 64)
         if postpad < 64:
             data = data + ("\000" * postpad)
         hash.update(data)
     digest = hash.digest()
     key = [0] * 8
     for i in range(0, len(digest)):
         key[i % 8] ^= ord(digest[i])
     return ''.join(chr(x) for x in key)
Beispiel #5
0
 def calculate_deskey(self):
     hashfiles = ['/meta', '/DRMStorage/DRMSource']
     if self.drmlevel == 3:
         hashfiles.append('/DRMStorage/DRMBookplate')
     prepad = 2
     hash = mssha1.new()
     for name in hashfiles:
         data = self.get_file(name)
         if prepad > 0:
             data = ("\000" * prepad) + data
             prepad = 0
         postpad = 64 - (len(data) % 64)
         if postpad < 64:
             data = data + ("\000" * postpad)
         hash.update(data)
     digest = hash.digest()
     key = [0] * 8
     for i in xrange(0, len(digest)):
         key[i % 8] ^= ord(digest[i])
     return ''.join(chr(x) for x in key)
Beispiel #6
0
 def calculate_deskey(self):
     hashfiles = ['/meta', '/DRMStorage/DRMSource']
     if self.drmlevel == 3:
         hashfiles.append('/DRMStorage/DRMBookplate')
     prepad = 2
     hash = mssha1.new()
     for name in hashfiles:
         data = self.get_file(name)
         if prepad > 0:
             data = (b"\000" * prepad) + data
             prepad = 0
         postpad = 64 - (len(data) % 64)
         if postpad < 64:
             data = data + (b"\000" * postpad)
         hash.update(data)
     digest = hash.digest()
     if not isinstance(digest, bytes):
         digest = digest.encode('ascii')
     digest = bytearray(digest)
     key = bytearray(8)
     for i, d in enumerate(digest):
         key[i % 8] ^= d
     return bytes(key)
Beispiel #7
0
 def calculate_deskey(self):
     hashfiles = ['/meta', '/DRMStorage/DRMSource']
     if self.drmlevel == 3:
         hashfiles.append('/DRMStorage/DRMBookplate')
     prepad = 2
     hash = mssha1.new()
     for name in hashfiles:
         data = self.get_file(name)
         if prepad > 0:
             data = (b"\000" * prepad) + data
             prepad = 0
         postpad = 64 - (len(data) % 64)
         if postpad < 64:
             data = data + (b"\000" * postpad)
         hash.update(data)
     digest = hash.digest()
     if not isinstance(digest, bytes):
         digest = digest.encode('ascii')
     digest = bytearray(digest)
     key = bytearray(8)
     for i, d in enumerate(digest):
         key[i % 8] ^= d
     return bytes(key)