def decrypt_secret(secret, key):
 decrypted_data = ''
 j = 0
 for i in range(0, len(secret), 8):
  enc_block = secret[i:(i + 8)]
  block_key = key[j:(j + 7)]
  des_key = str_to_key(block_key)
  des = DES.new(des_key, DES.MODE_ECB)
  decrypted_data += des.decrypt(enc_block)
  j += 7
  if (len(key[j:(j + 7)]) < 7):
   j = len(key[j:(j + 7)])
 (dec_data_len,) = unpack('<L', decrypted_data[:4])
 return decrypted_data[8:(8 + dec_data_len)]

def decrypt_secret ( secret , key ) : decrypted_data = '' j = 0 for i in range ( 0 , len ( secret ) , 8 ) : enc_block = secret [ i : ( i + 8 ) ] block_key = key [ j : ( j + 7 ) ] des_key = str_to_key ( block_key ) des = DES . new ( des_key , DES . MODE_ECB ) decrypted_data += des . decrypt ( enc_block ) j += 7 if ( len ( key [ j : ( j + 7 ) ] ) < 7 ) : j = len ( key [ j : ( j + 7 ) ] ) ( dec_data_len , ) = unpack ( '<L' , decrypted_data [ : 4 ] ) return decrypted_data [ 8 : ( 8 + dec_data_len ) ]
python implementation of systemfunction005 .