1 Reply Latest reply on Jun 14, 2006 11:35 PM by The ScareCrow

    Number encryption, converting ASP code to Coldfusion

    jack-frost
      Hi guys,

      I was wondering if someone could help me out here.....

      I have currently got code in ASP VbScript that is taking a number, and encrypting it:

      Function EncryptText(strText, strPwd)

      For i = 1 To Len(strText)
      c = Asc(Mid(strText, i, 1))
      c = c + Asc(Mid(strPwd, (i Mod Len(strPwd)) + 1, 1))
      strBuff = strBuff & Chr(c And &HFF)
      Next
      EncryptText = strBuff

      End Function

      I need to convert it to Coldfusion for another site, so far I have:

      <cfset strBuff = "">
      <cfset Password = "@$.##j">
      <cfset cardnumber = int(#MyList#)>
      <cfloop index="i" from="1" to="#len(cardnumber)#">
      <cfset c = Asc(Mid(#cardnumber#, i, 1))>
      <cfset c = #c# + Asc(Mid(#Password#, (i Mod Len(#Password#)) + 1, 1))>
      <cfset strBuff = strBuff & Chr(#c# & 255)>
      </cfloop>

      But for some reason the code doesnt seem to work, can anyone help??

      Many thanks in advance