"I keep it in a text file, how to decrypt??
S=StrConv ("? 槏 t 罀 gp? ? Ok You Zun 鶃 ", vbFromUnicode) 's="" here, why???
S=StrConv (rlt1 vbUnicode)
D.E ncryptDes_ArrToArr rlt1, data, 2
Text1. Text=StrConv (data, vbUnicode)
CodePudding user response:
In the form of bytes stored in the variable transformationCodePudding user response:
High strength of the encryption algorithm, clear after encryption "ciphertext", only words throttle,Also is to use type Byte array to the preservation and processing,
If you think of it as a "text characters,"
Because there is no corresponding character, a lot of content system in the process of transformation, basically is to use es question marks instead of,
Such a "conversion," content is changed, even reversible encryption algorithm, also cannot decrypt again restore,
Who put it can display characters encrypted or to display character, are very simple, the original algorithm,
From the point of view of cryptography, is completely untenable,
CodePudding user response:
Private mDES As clsDES
The Public Function Encode (ByVal vString As String, ByVal vCode As String) As String
Dim vbytePwd () As Byte
On Error GoTo Errorhandle
If vString="" Then
Encode=""
The Exit Function
End the If
If mDES Is Nothing Then Set mDES=New clsDES
Let vbytePwd=StrConv (vString vbUnicode)
Call mDES. EncryptByte (vbytePwd vCode)
Encode=pByteToHex (vbytePwd)
The Exit Function
Errorhandle:
Encode=""
End the Function
The Public Function Decode (ByVal vString As String, ByVal vCode As String) As String
Dim vbytePwd () As Byte
On Error GoTo Errorhandle
If LenB (vString)=0 Then the Exit Function
If mDES Is Nothing Then Set mDES=New clsDES
Let vbytePwd=pHexToByte (vString)
Call mDES. DecryptByte (vbytePwd vCode)
Decode=StrConv (vbytePwd vbFromUnicode)
The Exit Function
Errorhandle:
Decode=""
End the Function
Private Function pByteToHex (ByteArr () As Byte) As String
On the Error Resume Next
Dim Temps As String
Dim As Long I
For I=0 To UBound (ByteArr)
Temps=Hex (ByteArr (I))
Temps=Right (" 00 "& amp; Temps, 2)
PByteToHex=pByteToHex & amp; Temps
Next
End the Function
Private Function pHexToByte (ByVal HexStr As String) As Byte ()
Dim As Long I
Dim vLen As Long
Dim vArr () As Byte
If LenB (HexStr)=0 Then the Exit Function
VLen=Len (HexStr) \ 2
ReDim vArr (vLen - 1)
For I=0 To vLen - 1
Let vArr (I)=Val (" & amp; H "& amp; Mid $(HexStr, I * 2 + 1, 2))
Next
Let pHexToByte=vArr
End the Function
CodePudding user response:
Into a Byte array of encrypted cryptograph hex strings to the text,Decryption, the text and then turned back to Byte array,