How do I delete this thread?
Rather than [Ctrl+X], try [Ctrl+C][Ctrl+V]

:
B4X:
Sub PasswordToSubX(Pwd As String) As List
Dim B() As Byte = Pwd.GetBytes("UTF8")
Dim L As List
L.Initialize
L.Add("Private Sub X() As String")
L.Add(" Dim b(" & B.Length & ") As Byte")
RndSeed(DateTime.Now)
For I = 0 To Pwd.Length - 1
Dim ShiftBy As Int = Rnd(2, 24) 'will only shift by up-to 23, to avoid using sign bit
L.Add(" b(" & I & ") = Bit.ShiftRight(" & Bit.ShiftLeft(Bit.And(B(I), 0xFF), ShiftBy) & ", " & ShiftBy & ")")
Next
L.Add(" Return BytesToString(b, 0, " & Pwd.Length & ", ""UTF8"")")
L.Add("End Sub")
Return L
End Sub
and test with:
[CODE lang="b4x" highlight="8, 12"]
Sub AppStart (Args() As String)
Dim SubX As List = PasswordToSubX("L0ckN!nja7691")
For Each L As String In SubX
Log(L)
Next
Log(X) 'here's one I prepared earlier...
End Sub
'here's one I prepared earlier...
Private Sub X() As String
Dim b(13) As Byte
b(0) = Bit.ShiftRight(622592, 13)
b(1) = Bit.ShiftRight(393216, 13)
b(2) = Bit.ShiftRight(50688, 9)
b(3) = Bit.ShiftRight(3424, 5)
b(4) = Bit.ShiftRight(81788928, 20)
b(5) = Bit.ShiftRight(16896, 9)
b(6) = Bit.ShiftRight(3520, 5)
b(7) = Bit.ShiftRight(3473408, 15)
b(8) = Bit.ShiftRight(397312, 12)
b(9) = Bit.ShiftRight(1760, 5)
b(10) = Bit.ShiftRight(3456, 6)
b(11) = Bit.ShiftRight(119537664, 21)
b(12) = Bit.ShiftRight(200704, 12)
Return BytesToString(b, 0, 13, "UTF8")
End Sub
[/CODE]
[CODE lang="html" title="Log output" highlight="3-19"]
Waiting for debugger to connect...
Program started.
Private Sub X() As String
Dim b(13) As Byte
b(0) = Bit.ShiftRight(159383552, 21)
b(1) = Bit.ShiftRight(393216, 13)
b(2) = Bit.ShiftRight(12672, 7)
b(3) = Bit.ShiftRight(56098816, 19)
b(4) = Bit.ShiftRight(159744, 11)
b(5) = Bit.ShiftRight(264, 3)
b(6) = Bit.ShiftRight(220, 1)
b(7) = Bit.ShiftRight(868352, 13)
b(8) = Bit.ShiftRight(194, 1)
b(9) = Bit.ShiftRight(3520, 6)
b(10) = Bit.ShiftRight(55296, 10)
b(11) = Bit.ShiftRight(116736, 11)
b(12) = Bit.ShiftRight(102760448, 21)
Return BytesToString(b, 0, 13, "UTF8")
End Sub
L0ckN!nja7691
Program terminated (StartMessageLoop was not called).
[/CODE]