#include "dlutils.h"
                       
void split_url(const TString& url, TString& site, TString& service)
{
  int slash_pos = 0, slash_found = 0;
  for (int i = 0; url[i]; i++)  
  {                          
    if (url[i] == '/' || url[i] == '\\')
    {            
      if (slash_found == 0)
        slash_pos = i;
      slash_found++;
    }
    else
    {
      if (slash_found == 1)
        break;
      slash_found = slash_pos = 0; 
    }
  }
  
  if (slash_pos > 0)
  {
    site = url.left(slash_pos);
    service = url.mid(slash_pos);
  }
  else
  {
    site = url;
    service = "/";
  }
}

void cifratura_laziale(const TString& usr, const TString& pwd, TString& key)
{
  TString16 str;
  str.format("%-8s%-8s", (const char*)usr, (const char*)pwd);
  key.cut(0);             
  for (int i = 0; str[i]; i++)
    key << char(str[i] + 2*(i+1));
}