什麼是動態加密:
不知道這個算不算
///
///需要加密的字串
public static string EncrpyKey(string src)
{
int keyPos = 0, offset = 0, srcPos = 0, srcAsc = 0, range = 256;
string dest = "", temp = "";
Random rd = new Random();
offset = rd.Next(range);
dest = offset.ToString("x");
dest = dest.Length
dest = dest.Substring(dest.Length - 2);
for (srcPos = 0; srcPos
srcAsc = (Convert.ToInt32(src.Substring(srcPos, 1).ToCharArray()[0]) + offset) % 255;
keyPos = keyPos
srcAsc = srcAsc ^ (Convert.ToInt32("這裡放自定義字串(adadasda)".Substring(keyPos - 1, 1).ToCharArray()[0]));
temp = srcAsc.ToString("x");
temp = temp.Length
dest = dest + temp.Substring(temp.Length - 2);
offset = srcAsc;
}
return dest;
///需要解密的字串
public static string UncrypKey(string src)
int keyPos = 0, srcPos = 3, srcAsc = 0,
offset = Int32.Parse(src.Substring(0, 2), System.Globalization.NumberStyles.AllowHexSpecifier);
string dest = "";
do
srcAsc = Int32.Parse(src.Substring(srcPos - 1, 2), System.Globalization.NumberStyles.AllowHexSpecifier);
int tempSrcAsc = srcAsc ^ Convert.ToInt32(""這裡放自定義字串(adadasda)".Substring(keyPos - 1, 1).ToCharArray()[0]);
tempSrcAsc = tempSrcAsc
dest = dest + (char)tempSrcAsc;
srcPos = srcPos + 2;
} while (srcPos
這個加密方式特點:同一個資料每次加密出來的字元不通,但是解密出來都相同!
什麼是動態加密:
不知道這個算不算
///
///需要加密的字串
///
public static string EncrpyKey(string src)
{
int keyPos = 0, offset = 0, srcPos = 0, srcAsc = 0, range = 256;
string dest = "", temp = "";
Random rd = new Random();
offset = rd.Next(range);
dest = offset.ToString("x");
dest = dest.Length
dest = dest.Substring(dest.Length - 2);
for (srcPos = 0; srcPos
{
srcAsc = (Convert.ToInt32(src.Substring(srcPos, 1).ToCharArray()[0]) + offset) % 255;
keyPos = keyPos
srcAsc = srcAsc ^ (Convert.ToInt32("這裡放自定義字串(adadasda)".Substring(keyPos - 1, 1).ToCharArray()[0]));
temp = srcAsc.ToString("x");
temp = temp.Length
dest = dest + temp.Substring(temp.Length - 2);
offset = srcAsc;
}
return dest;
}
///
///需要解密的字串
///
public static string UncrypKey(string src)
{
int keyPos = 0, srcPos = 3, srcAsc = 0,
offset = Int32.Parse(src.Substring(0, 2), System.Globalization.NumberStyles.AllowHexSpecifier);
string dest = "";
do
{
srcAsc = Int32.Parse(src.Substring(srcPos - 1, 2), System.Globalization.NumberStyles.AllowHexSpecifier);
keyPos = keyPos
int tempSrcAsc = srcAsc ^ Convert.ToInt32(""這裡放自定義字串(adadasda)".Substring(keyPos - 1, 1).ToCharArray()[0]);
tempSrcAsc = tempSrcAsc
dest = dest + (char)tempSrcAsc;
offset = srcAsc;
srcPos = srcPos + 2;
} while (srcPos
return dest;
}
這個加密方式特點:同一個資料每次加密出來的字元不通,但是解密出來都相同!