(高分求助)想要个密码字典生成的VB或VB.NET代码,生成任意字符串的所有排列组合,包括子字符串的排列组
- 提问者网友:心如荒岛囚我终老
- 2021-03-10 15:44
- 五星知识达人网友:西风乍起
- 2021-03-10 15:54
- 1楼网友:胯下狙击手
- 2021-03-10 17:08
就这样了,大概还行
private function encrypt(byval strsource as string) as string '加密 dim blowdata as byte dim bhigdata as byte dim i as long dim k as integer dim strencrypt as string dim strchar as string dim keytemp as string dim key1 as byte for k = 1 to 30 keytemp = keytemp & cstr(int(rnd * (9) + 1)) next key1 = cbyte(mid(keytemp, 11, 1) & mid(keytemp, 27, 1)) for i = 1 to len(strsource) strchar = mid(strsource, i, 1) '从待加密字符串中取出一个字符 blowdata = ascb(midb(strchar, 1, 1)) xor key1 '取字符的低字节和key1进行异或运算 shigdata = ascb(midb(strchar, 2, 1)) '取字符的高字节 strencrypt = strencrypt & chrb(blowdata) & chrb(bhigdata) '将运算后的数据合成新的字符 next i encrypt = keytemp & strencrypt end function
private function decrypt(byval strsource as string) as string '解密 dim blowdata as byte dim bhigdata as byte dim i as long dim k as integer dim strdecrypt as string dim strchar as string dim keytemp as string dim key1 as byte keytemp = mid(strsource, 1, 30) key1 = cbyte(mid(keytemp, 11, 1) & mid(keytemp, 27, 1)) for i = 31 to len(strsource) strchar = mid(strsource, i, 1) '从待解密字符串中取出一个字符 blowdata = ascb(midb(strchar, 1, 1)) xor key1 '取字符的低字节和key1进行异或运算 bhigdata = ascb(midb(strchar, 2, 1)) '取字符的高字节 strdecrypt = strdecrypt & chrb(blowdata) & chrb(bhigdata) '将运算后的数据合成新的字符 next i decrypt = strdecrypt
end function
private sub command2_click() msgbox decrypt(inputbox("")) end sub
private sub command1_click() text1.text = encrypt(inputbox("")) end sub