title: C to PHP password encrypt (reversed)
body: <p>I have a windows application that encrypts user passwords using a reverse of this C code (the below decodes):</p>
  
  <pre><code>static void PasswordDecode(char * szPassword)
  {
  char szEncode[1024];
  char strDecodePass[_MAX_BUF_LEN + 1]={""}, strPass[_MAX_BUF_LEN + 1]={""};
  strcpy(strDecodePass, szPassword);
  for(unsigned int i = 0; i &lt; strlen(strDecodePass)/3; i ++)
  {
  char szCode[_MAX_BUF_LEN + 1];
  strcpy(szCode, strDecodePass + i * 3);
  szCode[3] = 0;
  int nCode = atoi(szCode);
  nCode = 999 - nCode;
  sprintf(szEncode, "%c", nCode);
  strcat(strPass, szEncode);
  }
  
  strcpy(szPassword, strPass);
  
  return;
  }; 
  </code></pre>
  
  <p>What I'm looking for is the ability to encode passwords using this algorithm (but with PHP) so that I can import user accounts into the application.</p>
  
  <p>Can anyone help? </p>
  
  <p>TIA
  Jim</p>