Roje Jose

Roje Jose

  • NA
  • 2
  • 0

Represenation of special characters

Mar 31 2006 12:39 AM

when i convert my charcters into ascii and then multiply each character by some constant value, its giving me some un identifiable characters which is exactly wat i need for password encryption. i am able to decrypt these characters to the original ones in the code behind page. but when i try represent these characters in the database, its represented as '?' and i am not able decrypt those characters... this is the code which i use to encrypt

public string enCrypt(String strValue)
    {
        int index, nextChr, iAscii;
        string strNewStringValue = "";
        char[] chrValue = strValue.ToCharArray();
        for (index = 0; index <= chrValue.Length - 1; index++)
        {
            // take the next character in the string
            nextChr = (int)chrValue[index];

            // find out the character code
            iAscii = (int)nextChr;
            //encryption
            iAscii = iAscii * 2;

            //add the current character to the string returned by the function
            strNewStringValue = strNewStringValue + (char)iAscii;
        }
        return (strNewStringValue);
    }

This code is working exactly fine in the code behind pages. but once i try to store the return string value for some characters, its going haywire. please help me in this matter.....