code: def calc_resp(password_hash, server_challenge):
      
      # padding with zeros to make the hash 21 bytes long
      password_hash += b'\0' * (21 - len(password_hash))
  
      res = b''
      dobj = des.DES(password_hash[0:7])
      res = res + dobj.encrypt(server_challenge[0:8])
  
      dobj = des.DES(password_hash[7:14])
      res = res + dobj.encrypt(server_challenge[0:8])
  
      dobj = des.DES(password_hash[14:21])
      res = res + dobj.encrypt(server_challenge[0:8])
      return res
docs: calc_resp generates the LM response given a 16-byte password hash and the
          challenge from the Type-2 message.
          @param password_hash
              16-byte password hash
          @param server_challenge
              8-byte challenge from Type-2 message
          returns
              24-byte buffer to contain the LM response upon return