def computeObjectKey(id, generationNum, encryptionKey, keyLengthBytes, algorithm='RC4'):
 key = ((encryptionKey + struct.pack('<i', id)[:3]) + struct.pack('<i', generationNum)[:2])
 if (algorithm == 'AES'):
  key += 'sAlT'
 key = hashlib.md5(key).digest()
 if ((keyLengthBytes + 5) < 16):
  key = key[:(keyLengthBytes + 5)]
 else:
  key = key[:16]
 return key

def computeObjectKey ( id , generationNum , encryptionKey , keyLengthBytes , algorithm = 'RC4' ) : key = ( ( encryptionKey + struct . pack ( '<i' , id ) [ : 3 ] ) + struct . pack ( '<i' , generationNum ) [ : 2 ] ) if ( algorithm == 'AES' ) : key += 'sAlT' key = hashlib . md5 ( key ) . digest ( ) if ( ( keyLengthBytes + 5 ) < 16 ) : key = key [ : ( keyLengthBytes + 5 ) ] else : key = key [ : 16 ] return key
compute the key necessary to encrypt each object .