国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

一個簡單的加密/解密方法

2024-07-21 02:16:01
字體:
來源:轉載
供稿:網友

private function encryptstring(strstring)
dim charhexset, intstringlen, strtemp, strraw, i, intkey, intoffset
randomize timer

intkey = round((rnd * 1000000) + 1000000) '##### key bitsize
intoffset = round((rnd * 1000000) + 1000000) '##### keyoffset bitsize

if isnull(strstring) = false then
strraw = strstring
intstringlen = len(strraw)

for i = 0 to intstringlen - 1
strtemp = left(strraw, 1)
strraw = right(strraw, len(strraw) - 1)
charhexset = charhexset & hex(asc(strtemp) * intkey)& hex(intkey)
next

encryptstring = charhexset & "|" & hex(intoffset + intkey) & "|" & hex(intoffset)
else
encryptstring = ""
end if
end function

private function decryptstring(strcryptstring)
dim strraw, arhexcharset, i, intkey, intoffset, strrawkey, strhexcrypdata

strrawkey = right(strcryptstring, len(strcryptstring) - instr(strcryptstring, "|"))
intoffset = right(strrawkey, len(strrawkey) - instr(strrawkey,"|"))
intkey = hexconv(left(strrawkey, instr(strrawkey, "|") - 1)) - hexconv(intoffset)
strhexcrypdata = left(strcryptstring, len(strcryptstring) - (len(strrawkey) + 1))

arhexcharset = split(strhexcrypdata, hex(intkey))

for i=0 to ubound(arhexcharset)
strraw = strraw & chr(hexconv(arhexcharset(i))/intkey)
next

decryptstring = strraw
end function

private function hexconv(hexvar)
dim hxx, hxx_var, multiply
if hexvar <> "" then
hexvar = ucase(hexvar)
hexvar = strreverse(hexvar)
dim hx()
redim hx(len(hexvar))
hxx = 0
hxx_var = 0
for hxx = 1 to len(hexvar)
if multiply = "" then multiply = 1
hx(hxx) = mid(hexvar,hxx,1)
hxx_var = (get_hxno(hx(hxx)) * multiply) + hxx_var
multiply = (multiply * 16)
next
hexvar = hxx_var
hexconv = hexvar
end if
end function

private function get_hxno(ghx)
if ghx = "a" then
ghx = 10
elseif ghx = "b" then
ghx = 11
elseif ghx = "c" then
ghx = 12
elseif ghx = "d" then
ghx = 13
elseif ghx = "e" then
ghx = 14
elseif ghx = "f" then
ghx = 15
end if
get_hxno = ghx
end function

  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • 發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 黑水县| 延吉市| 信丰县| 焉耆| 宜昌市| 通城县| 娄烦县| 萨嘎县| 云南省| 宜都市| 浠水县| 德令哈市| 奉贤区| 武隆县| 福贡县| 温州市| 德阳市| 海阳市| 淅川县| 申扎县| 开江县| 丁青县| 铜山县| 图木舒克市| 收藏| 乌兰县| 珲春市| 马公市| 武汉市| 临澧县| 垣曲县| 芒康县| 衡水市| 博罗县| 修文县| 红原县| 惠来县| 同江市| 合水县| 巢湖市| 临澧县|