纯猝使用VBScript来实现加密

789vb456vb

789vb456vb

2016-01-29 18:27

纯猝使用VBScript来实现加密,纯猝使用VBScript来实现加密
  <%
'### To encrypt/decrypt include this code in your page
'### strMyEncryptedString = EncryptString(strString)
'### strMyDecryptedString = DeCryptString(strMyEncryptedString)
'### You are free to use this code as long as credits remain in place
'### also if you improve this code let me know.

Private Function EncryptString(strString)
'####################################################################
'### Crypt Function (C) 2001 by Slavic Kozyuk grindkore@yahoo.com ###
'### Arguments: strString <--- String you wish to encrypt         ###
'### Output: Encrypted HEX string                                 ###
'####################################################################

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)
'####################################################################
'### Crypt Function (C) 2001 by Slavic Kozyuk grindkore@yahoo.com ###
'### Arguments: Encrypted HEX stringt       ###
'### Output: Decrypted ASCII string                               ###
'####################################################################
'### Note this function uses HexConv() and get_hxno() functions   ###
'### so make sure they are not removed
  ###
'####################################################################

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
hexVa
展开更多 50%)
分享

猜你喜欢

纯猝使用VBScript来实现加密

ASP
纯猝使用VBScript来实现加密

实例应用:使用PHP来进行加密与解密

PHP
实例应用:使用PHP来进行加密与解密

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

纯ASP(VBscript)写的全球IP地址搜索程序

ASP
纯ASP(VBscript)写的全球IP地址搜索程序

实现文件加密功能

C语言教程 C语言函数
实现文件加密功能

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

实现分页的例子-使用存储过程来实现分页

ASP
实现分页的例子-使用存储过程来实现分页

在VBScript中使用类

Web开发
在VBScript中使用类

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

Photoshop鼠绘教程:绘制逼真的美丽蝴蝶

Photoshop鼠绘教程:绘制逼真的美丽蝴蝶

将金山词霸的音标放到Word中

将金山词霸的音标放到Word中
下拉加载更多内容 ↓