只有一个方法,使用的时候很简单,比如要加密就这样endecode("data",1234) 解密的时候还是这样endecode("data",1234)。很简单的。 代码: public class encryption public function endecode(byval source as string, byval key as integer) as string dim x as single dim intcharnumber as integer dim shtradint as short dim strchar as string dim strtmp as string if key < 0 then key = key * (-1) end if x = rnd(-key) dim i as integer for i = 1 to len(source) step 1 strchar = mid(source, i, 1) intcharnumber = asc(strchar) whileencode: shtradint = int(127 * rnd()) if shtradint < 30 or shtradint > 100 then goto whileencode intcharnumber = intcharnumber xor shtradint strtmp = strtmp & chr(intcharnumber) next i endecode = strtmp exit function end function end class