public sub main()
dim key as string
for i = 1 to 16
randomize
key = key & chr(rnd * 255)
next i
msgbox rc4(rc4("welcome to plindge studio!", key), key)
end sub
public function rc4(inp as string, key as string) as string
dim s(0 to 255) as byte, k(0 to 255) as byte, i as long
dim j as long, temp as byte, y as byte, t as long, x as long
dim outp as string
for i = 0 to 255
s(i) = i
next
j = 1
for i = 0 to 255
if j > len(key) then j = 1
k(i) = asc(mid(key, j, 1))
j = j + 1
next i
j = 0
for i = 0 to 255
j = (j + s(i) + k(i)) mod 256
temp = s(i)
s(i) = s(j)
s(j) = temp
next i
i = 0
j = 0
for x = 1 to len(inp)
i = (i + 1) mod 256
j = (j + s(i)) mod 256
temp = s(i)
s(i) = s(j)
s(j) = temp
t = (s(i) + (s(j) mod 256)) mod 256
y = s(t)
outp = outp & chr(asc(mid(inp, x, 1)) xor y)
next
rc4 = outp
end function
RC4加密演算法在C 中的實現
在一些場合,常需要用到一些簡單的加密演算法,這裡的rc4就可以說是最簡單的一種。只要設定乙個足夠強的密碼,就可以適用於一些非常簡單的場合了。我是用來加密http傳送的資料的。rc4函式 加密 解密 其實,rc4只有加密,將密文再加密一次,就是解密了。getkey函式 隨機字串產生器,呵呵,為了方便,...
RC4加密演算法在C 中的實現
在一些場合,常需要用到一些簡單的加密演算法,這裡的rc4就可以說是最簡單的一種。只要設定乙個足夠強的密碼,就可以適用於一些非常簡單的場合了。我是用來加密http傳送的資料的。rc4函式 加密 解密 其實,rc4只有加密,將密文再加密一次,就是解密了。getkey函式 隨機字串產生器,呵呵,為了方便,...
VB 6 0中的RC4加密演算法
public function rc4 inp as string,key as string as string dim s 0 to 255 as byte,k 0 to 255 as byte,i as long dim j as long,temp as byte,y as byte,t a...