用ASP編寫的加密和解密類
更新時間:2007年11月23日 22:11:38 作者:
class Base64Class
rem Const
dim sBASE_64_CHARACTERS'轉(zhuǎn)化碼
dim lenString '計算字符串的長度
dim iCount '計數(shù)器
dim returnValue '返回值
dim tempChar'緩存字符
dim tempString'緩存字符串
dim paramString '參數(shù)字符串
dim temHex'緩存緩存十六進制
dim tempLow'緩存低位
dim tempHigh'緩存高位
dim mod3String'
dim mod4String'
dim tempBinary'
dim tempByteOne'
dim tempByteTwo'
dim tempByteThree'
dim tempByteFour'
dim tempSaveBitsOne'
dim tempSaveBitsTwo'
'********************************************
'begin初始化類
'********************************************
private sub Class_Initialize()
sBASE_64_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" end sub
'********************************************
'end初始化類 '
********************************************
'********************************************
'begin銷毀類
'********************************************
Private Sub Class_Terminate()
sBASE_64_CHARACTERS="" end sub
'********************************************
'end銷毀類
'********************************************
'********************************************
'begin將Ansi編碼的字符串進行Base64編碼
'********************************************
public function Encode(paramString)
tempString=""
returnValue=""
lenString=len(paramString)
if lenString<1 then
Encode=returnValue
else
mod3String=lenString mod 3
'補足位數(shù)是為了便于計算
if mod3String>0 then
lenString=lenString+3-mod3String
lenString=lenString-3
end if
rem Const
dim sBASE_64_CHARACTERS'轉(zhuǎn)化碼
dim lenString '計算字符串的長度
dim iCount '計數(shù)器
dim returnValue '返回值
dim tempChar'緩存字符
dim tempString'緩存字符串
dim paramString '參數(shù)字符串
dim temHex'緩存緩存十六進制
dim tempLow'緩存低位
dim tempHigh'緩存高位
dim mod3String'
dim mod4String'
dim tempBinary'
dim tempByteOne'
dim tempByteTwo'
dim tempByteThree'
dim tempByteFour'
dim tempSaveBitsOne'
dim tempSaveBitsTwo'
'********************************************
'begin初始化類
'********************************************
private sub Class_Initialize()
sBASE_64_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" end sub
'********************************************
'end初始化類 '
********************************************
'********************************************
'begin銷毀類
'********************************************
Private Sub Class_Terminate()
sBASE_64_CHARACTERS="" end sub
'********************************************
'end銷毀類
'********************************************
'********************************************
'begin將Ansi編碼的字符串進行Base64編碼
'********************************************
public function Encode(paramString)
tempString=""
returnValue=""
lenString=len(paramString)
if lenString<1 then
Encode=returnValue
else
mod3String=lenString mod 3
'補足位數(shù)是為了便于計算
if mod3String>0 then
lenString=lenString+3-mod3String
lenString=lenString-3
end if
相關(guān)文章
ASP中類Class相關(guān)內(nèi)容的整理資料
ASP中類Class相關(guān)內(nèi)容的整理資料...2007-03-03實現(xiàn)支持邏輯搜索/單詞搜索/詞組搜索+支持OR/AND關(guān)鍵字的VBS CLASS!
實現(xiàn)支持邏輯搜索/單詞搜索/詞組搜索+支持OR/AND關(guān)鍵字的VBS CLASS!...2006-08-08