예제 #1
0
 def test_transform_key(self):
     self.assertEquals(transform_key(sha256(b'a'), sha256(b'b'), 1),
         b'"$\xe6\x83\xb7\xbf\xa9|\x82W\x01J\xce=\xaa\x8d{\x18\x99|0\x1f'
         b'\xbbLT4"F\x83\xd0\xc8\xf9')
     self.assertEquals(transform_key(sha256(b'a'), sha256(b'b'), 2000),
         b'@\xe5Y\x98\xf7\x97$\x0b\x91!\xbefX\xe8\xb6\xbb\t\xefX>\xb3E\x85'
         b'\xedz\x15\x9c\x96\x03K\x8a\xa1')
예제 #2
0
 def test_transform_key(self):
     self.assertEqual(transform_key(sha256(b'a'), sha256(b'b'), 1),
                       b'"$\xe6\x83\xb7\xbf\xa9|\x82W\x01J\xce=\xaa\x8d{\x18\x99|0\x1f'
                       b'\xbbLT4"F\x83\xd0\xc8\xf9')
     self.assertEqual(transform_key(sha256(b'a'), sha256(b'b'), 2000),
                       b'@\xe5Y\x98\xf7\x97$\x0b\x91!\xbefX\xe8\xb6\xbb\t\xefX>\xb3E\x85'
                       b'\xedz\x15\x9c\x96\x03K\x8a\xa1')
예제 #3
0
 def _make_master_key(self):
     """
     Make the master key by (1) combining the credentials to create 
     a composite hash, (2) transforming the hash using the transform seed
     for a specific number of rounds and (3) finally hashing the result in 
     combination with the master seed.
     """
     super(KDB4File, self)._make_master_key()
     composite = sha256(b''.join(self.keys))
     tkey = transform_key(composite, self.header.TransformSeed,
                          self.header.TransformRounds)
     self.master_key = sha256(self.header.MasterSeed + tkey)
예제 #4
0
파일: kdb4.py 프로젝트: adsworth/libkeepass
 def _make_master_key(self):
     """
     Make the master key by (1) combining the credentials to create 
     a composite hash, (2) transforming the hash using the transform seed
     for a specific number of rounds and (3) finally hashing the result in 
     combination with the master seed.
     """
     super(KDB4File, self)._make_master_key()
     composite = sha256(b''.join(self.keys))
     tkey = transform_key(composite, 
         self.header.TransformSeed, 
         self.header.TransformRounds)
     self.master_key = sha256(self.header.MasterSeed + tkey)
예제 #5
0
 def _make_master_key(self):
     """
     Make the master key by (1) combining the credentials to create 
     a composite hash, (2) transforming the hash using the transform seed
     for a specific number of rounds and (3) finally hashing the result in 
     combination with the master seed.
     """
     super(KDB3File, self)._make_master_key()
     # print "masterkey:", ''.join(self.keys).encode('hex')
     #composite = sha256(''.join(self.keys))
     #TODO python-keepass does not support keyfiles, there seems to be a
     # different way to hash those keys in kdb3
     composite = self.keys[0]
     tkey = transform_key(composite, self.header.MasterSeed2,
                          self.header.KeyEncRounds)
     self.master_key = sha256(self.header.MasterSeed + tkey)
예제 #6
0
파일: kdb3.py 프로젝트: adsworth/libkeepass
 def _make_master_key(self):
     """
     Make the master key by (1) combining the credentials to create 
     a composite hash, (2) transforming the hash using the transform seed
     for a specific number of rounds and (3) finally hashing the result in 
     combination with the master seed.
     """
     super(KDB3File, self)._make_master_key()
     #print "masterkey:", ''.join(self.keys).encode('hex')
     #composite = sha256(''.join(self.keys))
     #TODO python-keepass does not support keyfiles, there seems to be a
     # different way to hash those keys in kdb3
     composite = self.keys[0]
     tkey = transform_key(composite, 
         self.header.MasterSeed2, 
         self.header.KeyEncRounds)
     self.master_key = sha256(self.header.MasterSeed + tkey)