1.VB å å¯ä¸è§£å¯çç¨åºä»£ç
2.vbå¦ä½ç¨unicodeç¼ç å®ç°MD5å å¯
3.vb 请问怎么将写入.txt文件的加密加密python互动课堂源码内容加密
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å¦ä½ç¨unicodeç¼ç å®ç°MD5å å¯
''' <summary>çæä½å å¯å符串</summary>
''' <param name="strSource">éè¦å å¯çå符串</param>
''' <returns>å å¯å®æçä½å符串</returns>
''' <remarks></remarks>
Friend Function creatMD5(ByRef strSource As String)
Dim dataToHash As Byte() = (New System.Text.UnicodeEncoding).GetBytes(strSource.ToCharArray)
Dim hashvalue As Byte() = CType(Cryptography.CryptoConfig.CreateFromName("MD5"), Cryptography.HashAlgorithm).ComputeHash(dataToHash)
Dim strSB As New System.Text.StringBuilder
For i = 0 To hashvalue.Length - 1
strSB.Append(hashvalue(i).ToString("x2"))
Next
creatMD5 = strSB.ToString
Return creatMD5
End Function
è°ç¨ ï¼creatMD5("md5")
å¾å° ï¼dadbcdaead7eab
å¦æä¸å®è¦å¤§åï¼æ¹ä¸ä¸ï¼creatMD5 = strSB.ToString.ToUpper
vb 请问怎么将写入.txt文件的内容加密
简单点加密就用 异或Dim b() As Byte, i As Longb = StrConv("test", vbFromUnicode)
For i = 0 To UBound(b)
b(i) = b(i) Xor
Next
将数组b内容保存到文本
同样的代码 解密
2024-12-29 01:22
2024-12-29 01:11
2024-12-29 00:57
2024-12-29 00:00
2024-12-28 23:59
2024-12-28 23:53