1.VB怎编写明文加密和解密
2.Vb编程编写一个小程序,源码可以对输入的加密rxjava中merge源码一段英文字符串进行加密和解密,加密算法中需要使用到学号后两位
3.VB å å¯ä¸è§£å¯çç¨åºä»£ç
4.VBä¸å¦ä½ç¼åä¸ä¸ªå å¯ç¨åº?源码棋牌群网站源码
VB怎编写明文加密和解密
Private Sub Command2_Click()
Dim strIN As String, strOUT As String, sec As String, strp As String, num As Integer, i As Integer, j As Double
sec = "QWERTYUIOPASDFGHJKLZXCVBMN"
strIN = Text2.Text '输入
strIN = Replace(strIN, "KBK", " ") '空格处理
num = Len(strIN)
For i = 1 To num
strp = Mid(strIN, i, 1) '取得自符
j = InStr(1, sec, strp)
If j < 0 Then
'保留原来字符
Debug.Print "*" & strp & "*"
Else
strp = Chr(j + Asc("a") - 1)
End If
strOUT = strOUT & strp
Next i
Text1.Text = strOUT
End Sub
==================================
Vb编程编写一个小程序,可以对输入的加密打字游戏的源码一段英文字符串进行加密和解密,加密算法中需要使用到学号后两位
以下是源码nginx分配算法源码根据学号末2位加密、解密的加密小小屠龙源码下载VB程序:Private Sub Form_Click()
x = Val(Right(Text1.Text, 2)) '取学号末2位
'以下是加密
s = Text2.Text
s1 = s
For i = 1 To Len(s)
c = Mid(s1, i, 1)
Mid(s1, i, 1) = Chr(Asc(c) Xor x)
Next i
Text3.Text = s1
'以下是解密
s = s1
For i = 1 To Len(s)
c = Mid(s, i, 1)
Mid(s, i, 1) = Chr(Asc(c) Xor x)
Next i
Text4.Text = s
End Sub
VB å å¯ä¸è§£å¯çç¨åºä»£ç
å å¯ï¼Private Function JiaMi(ByVal varPass As String) As String 'åæ°varPassæ¯éè¦å å¯çææ¬å 容
Dim varJiaMi As String *
Dim varTmp As Double
Dim strJiaMi As String
Dim I
For I = 1 To Len(varPass)
varTmp = AscW(Mid$(varPass, I, 1))
varJiaMi = Str$(((((varTmp * 1.5) / 5.6) * 2.7) * I))
strJiaMi = strJiaMi & varJiaMi
Next I
JiaMi = strJiaMi
End Function
解å¯å½æ°ï¼
Private Function JieMi(ByVal varPass As String) As String 'åæ°varPassæ¯éè¦è§£å¯çå¯æå 容
Dim varReturn As String *
Dim varConvert As Double
Dim varFinalPass As String
Dim varKey As Integer
Dim varPasslenth As Long
varPasslenth = Len(varPass)
For I = 1 To varPasslenth /
varReturn = Mid(varPass, (I - 1) * + 1, )
varConvert = Val(Trim(varReturn))
varConvert = ((((varConvert / 1.5) * 5.6) / 2.7) / I)
varFinalPass = varFinalPass & ChrW(Val(varConvert))
Next I
JieMi = varFinalPass
End Function
æ©å±èµæï¼æ³¨æäºé¡¹
ç¼åå å¯ç¨åºï¼å°ç¨æ·è¾å ¥çä¸ä¸ªè±æå¥åå å¯ä¸ºå å¯å符串ï¼ç¶åè¾åºå å¯å符串ãå设å¥åé¿åº¦ä¸è¶ è¿ä¸ªå符ã
æ ¹æ®ç»å®çå¥åå å¯å½æ°ååSentenceEncodingï¼ç¼åå½æ°SentenceEncodingè°ç¨ç»å®çå符å å¯å½æ°CharEncodingå®æå¥åå å¯ã
ç¶åï¼ç¼å主ç¨åºæ示ç¨æ·è¾å ¥è±æå¥åï¼ç¶åè°ç¨å½æ°SentenceEncoding对å¥åå å¯ï¼æåè¾åºå å¯åçå¥åã
å符å å¯è§å为大ååæ¯åå°ååæ¯åå å¯ä¸ºå ¶è¡¥ç , æ们å®ä¹ASCIIç å¼ç¸å 为âAâ+âZâå³ç两个大ååæ¯äºä¸ºè¡¥ç ï¼ASCIIç å¼ç¸å 为âaâ+âzâå³ç两个å°ååæ¯äºä¸ºè¡¥ç ã
ç©ºæ ¼ç¨@代æ¿,å¥å·ä»¥#代æ¿,å ¶å®å符ç¨å¥ç¹ä»£æ¿ã
å½æ°ååï¼
void SentenceEncoding(char *soure,char *code);
åè½ï¼å¯¹å¾ å å¯å符串sourceå å¯åä¿åå å¯å符串å°code.
åæ°ï¼char *soureï¼æåå¾ å å¯å¥åçå符串æéï¼
char *code æåå å¯å符串çå符串æéï¼
å符å å¯å½æ°ä»£ç ã
VBä¸å¦ä½ç¼åä¸ä¸ªå å¯ç¨åº?
ç¼åä¸ä¸ªå å¯è½¯ä»¶ï¼è¦æ±å°æºæ件æåèéä½åæåºå å¯æ³å å¯ã
åèéä½åæåºå å¯æ³æ¯ä»¥æ¯ç¹ä¸ºåä½çæ¢ä½å å¯æ¹æ³ï¼ç¨vbå®ç°çå ·ä½ç®æ³æ¯ï¼
(1) 以äºè¿å¶æ¨¡å¼æå¼æºæ件ï¼
(2) ä»æºæ件第iä½è¯»åä¸ä¸ªåèï¼å设为åæ¯âaâï¼å¾å°âaâçasciiå¼ä¸ºï¼
(3) å°è½¬æ¢æå «ä½äºè¿å¶ä¸²ä¸ºââï¼
(4) å°ââæåèéä½åæåºå¾å¦ä¸ä¸ªå «ä½äºè¿å¶ä¸²ââï¼
(5) å°ââ转æ¢æåè¿å¶åååæºæ件第iä½ç½®ï¼å®æä¸ä¸ªåèçå å¯ï¼
(6) éå¤(2)ã(3)ã(4)å(5)ï¼ç´å°ææåèå å¯ç»æã
为äºä½¿ç¨åºæ¨¡ååï¼æ们ç¨å½æ°è¿ç¨bytetobinå®æå°åèåæ°æ®è½¬æ¢æäºè¿å¶ä¸²ï¼å ¶å®è´¨å°±æ¯å°åè¿å¶æ°è½¬æ¢æå «ä½äºè¿å¶ä¸²ï¼ï¼ç¨å½æ°è¿ç¨bintobyteå°äºè¿å¶ä¸²è½¬æ¢æåèåæ°æ®ï¼å®è´¨æ¯å°å «ä½äºè¿å¶ä¸²è½¬æ¢æåè¿å¶æ°ï¼ï¼ç¨å½æ°è¿ç¨reverseå°å «ä½äºè¿å¶ä¸²éä½åæåºãå ·ä½ç¨åºå¦ä¸ï¼
function bytetobin(m as byte) as string ' å°åèåæ°æ®è½¬æ¢æå «ä½äºè¿å¶å符串
dim c$
c$ = ""
do while m <> 0
r = m mod 2
m = m \ 2
c$ = r & c$
loop
c$ = right("" & c$, 8)
bytetobin = c$
end function
function reverse(m as string) as string ' å°å «ä½äºè¿å¶åç¬¦ä¸²é¢ å顺åº
dim i%, x$
x = ""
for i = 1 to 8
x = mid(m, i, 1) & x
next i
reverse = x
end function
function bintobyte(m as string) as byte ' å°å «ä½äºè¿å¶ä¸²è½¬æ¢æåè¿å¶
dim x as string * 1, y%, z%
z = 0
for i = 1 to 8
x = mid(m, i, 1)
y = x * 2 ^ (8 - i)
z = z + y
next i
bintobyte = z
end function
private sub command1_click()
dim x as byte, i%, fname$
fname = inputbox("请è¾å ¥è¦å å¯çæ件åï¼æ³¨æå ä¸è·¯å¾åï¼")
if dir(fname) = "" then
msgbox "æ件ä¸åå¨ï¼"
exit sub
end if
open fname for binary as #1 ' 以äºè¿å¶è®¿é®æ¨¡å¼æå¼å¾ å å¯æ件
for i = 1 to lof(1) ' lofå½æ°æ¯æ±æ件é¿åº¦çå é¨å½æ°
get #1, i, x ' ååºç¬¬i个åè
x = bintobyte(reverse(bytetobin(x))) ' è¿éè°ç¨äºä¸ä¸ªèªå®ä¹å½æ°
put #1, i, x ' å°å å¯åçè¿ä¸ªåèååå°æ件åä½ç½®
next i
close
msgbox "ä»»å¡å®æï¼"
end sub