First of all, this algorithm has no special, just afraid of can't find it, so put it on this.
There are six results after each byte encryption (two bytes, if you need more than 6 types, you need to use 1 byte, ie 3 bytes), that is, if the word strings account for n If the result, the result may result in 6 N times, this algorithm is not strong, everyone can improve:
'Form on a button, two ListBoxOption Explicit
Private Sub Command1_Click () DIM I As Long Dim S AS String for i = 1 to 100 s = Encode ("This is a test hello world") list1.additem s s = decode (s) list2.additem s nextend Subprivate function encode (Byval s as string) AS string 'encryption if len (s) = 0 THEN EXIT FUNCTION DIM BUFF () AS BYTE BUFF = STRCONV (S, VBFROMUNICODE) DIM I as Long Dim J AS BYTE DIM K AS BYTE, M AS BYTE Dim mstr As String mstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz" Dim outs As String i = UBound (buff) 1 outs = Space (2 * i) Dim temps As String For i = 0 To UBound (buff) Randomize Time j = CByte (5 * (Math.Rnd ()) 0) 'The maximum random number can only be 5, can not be big, then, it is necessary to use one byte buff (i) = buff (i) xor j kff (i) MOD LEN (MSTR) M = Buff (i) / len (mstr) m = m * 2 ^ 3 J TEMPS = MID (MSTR, K 1, 1) MID (MSTR, M 1, 1 ) MID (OUTS, 2 * i 1, 2) = Temps next encode = outsend function