37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
Public Function ConvertFromSecureString(Ciphertext)
|
|
|
|
'Stand: 26.08.2020
|
|
'Source: https://gist.github.com/albert1205/c8430b5bfa505f9308e4fa789b9b1d7f
|
|
|
|
Const offset = 10
|
|
Const minAsc = 33
|
|
Const maxAsc = 126
|
|
|
|
If Len(Ciphertext) < 5 Then
|
|
Decrypt = ""
|
|
Exit Function
|
|
End If
|
|
|
|
Dim Plaintext
|
|
Ciphertext = Mid(Ciphertext,3,Len(Ciphertext)-4)
|
|
For i=2 To Len(Ciphertext) Step 2
|
|
oldAsc = Asc(Mid(Ciphertext,i,1)) + offset
|
|
If oldAsc > maxAsc Then
|
|
oldAsc = oldAsc - maxAsc + minAsc - 1
|
|
End If
|
|
Plaintext = Plaintext & Chr(oldAsc)
|
|
' MsgBox Asc(Mid(Ciphertext,i,1)) & " -> " & oldAsc
|
|
Next
|
|
ConvertFromSecureString = Plaintext
|
|
|
|
End Function
|
|
|
|
Private Sub DecryptTool()
|
|
|
|
Ciphertext = InputBox("Bitte den zu entschluesselnden String eingeben:","Eingabe erfolderlich","")
|
|
Plaintext = ConvertFromSecureString(Ciphertext)
|
|
InputBox "Ihre Eingabe lautete: " & Ciphertext & vbNewLine & vbNewLine & "Entschluesselt, sieht der String wie folgt aus:","Erledigt!",Plaintext
|
|
|
|
End Sub
|
|
|
|
'Call DecryptTool |