1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Sub Appel()
Dim s As String, AvantRSA As String, ApresRSA As String
s = "Ce FÈZ, n'eSt Pas d'une exceptionnelle qualitÈ"
Debug.Print s
AvantRSA = AvantCryptageRsa(s)
Debug.Print AvantRSA
ApresRSA = ApresCryptageRsa(AvantRSA)
Debug.Print ApresRSA
End Sub
Function AvantCryptageRsa(s As String) As String
Dim Tb() As Byte, i As Long, st As String
Tb = StrConv(s, vbUnicode)
For i = LBound(Tb) To UBound(Tb)
st = st & Tb(i)
Next
AvantCryptageRsa = st
End Function
Function ApresCryptageRsa(s As String) As String
Dim Tb, i As Long, out As String
s = Replace(s, "00000", "00 000")
s = Replace(s, "0000", "0 000")
Tb = Split(s, "000")
For i = LBound(Tb) To UBound(Tb) - 1
out = out & Chr$(RTrim$(Tb(i)))
Next i
ApresCryptageRsa = out
End Function |
Partager