ACTIVE SERVER PAGE > °£´ÜÇÑ ¾ÏÈ£È / º¹È£È ·ÎÁ÷
µî·ÏÀÏ : 2017-07-04 17:46
Á¶È¸¼ö : 53,272
ASP·Î ¸¸µé¾î º¸´Â °£´ÜÇÑ ¾ÏÈ£È º¹È£È ·ÎÁ÷ ÀÔ´Ï´Ù.
ȸ¿øÀÇ ¾ÆÀ̵ð, Æнº¿öµåµîÀ» DB¿¡ ÀúÀåÇÒ ¶§ ¾ÏÈ£È ÇÏ¿© ÀúÀåÀ» ÇÏ°Ô µË´Ï´Ù. ±×¸®°í ȸ¿øÀÌ ·Î±×ÀÎÀ» ÇÏ°Ô µÇ¸é
º¹È£È ÇÏ¿© ȸ¿øÀÌ ÀÔ·ÂÇÑ ¹®ÀÚ¿°ú ºñ±³ÇÏ¿© ·Î±×ÀÎ ¿©ºÎµîÀ» üŷÇÒ¼ö ÀÖ½À´Ï´Ù.
Const Ref = "D7EFGBCHL640MN598OIJKPQRSATWXVYZ123U"
' ¾ÏÈ£È
Function encode(str,chipVal)
Dim Temp, TempChar, Conv, Cipher, i : Temp = ""
chipVal = CInt(chipVal)
str = StringToHex(str)
for i = 0 to len(str) - 1
TempChar = Mid(str,i+1,1)
Conv = InStr(Ref,TempChar)-1
Cipher = Conv Xor chipVal
Cipher = Mid(Ref,Cipher+1,1)
Temp = Temp + Cipher
next
encode = Temp
End Function
' º¹È£È
Function decode(str,chipVal)
Dim Temp, TempChar, Conv, Cipher, i : Temp = ""
chipVal = CInt(chipVal)
for i = 0 to len(str) - 1
TempChar = Mid(str,i+1,1)
Conv = InStr(Ref,TempChar)-1
Cipher = Conv Xor chipVal
Cipher = Mid(Ref,Cipher+1,1)
Temp = Temp + Cipher
next
Temp = HexToString(Temp)
decode = Temp
End Function
' ¹®ÀÚ¿ -> 16Áø¼ö
Function StringToHex(pStr)
dim i, one_hex, retVal
for i = 1 to len(pStr)
one_hex = hex(asc(mid(pStr,i,1)))
retVal = retVal & one_hex
next
StringToHex = retVal
End Function
' 16Áø¼ö -> ¹®ÀÚ¿
Function HexToString(pHex)
dim one_hex, tmp_hex, i, retVal
for i = 1 to len(pHex)
one_hex = mid(pHex,i,1)
if IsNumeric(one_hex) then
tmp_hex = mid(pHex,i,2)
i = i + 1
else
tmp_hex = mid(pHex,i,4)
i = i + 3
end if
retVal = retVal & chr("&H" & tmp_hex)
next
HexToString = retVal
End Function
en1 = encode("761541-5425486 : ÀÌ»óÇÑ »ç¶÷ÀÌ´Ù.... ¤¾¤¾¤¾¤¾ !@#$%^&*()",2)
en2 = decode(en1,2)
Response.write en1 &"<br>"& en2
Ȥ½Ã »ç¿ëÇÒ ÀÏÀÌ ÀÖÀ¸½Ã¸é »ç¿ëÇϼ¼¿ä.