Code: Alles auswählen
Procedure.q ValX(S$, Basis.b)
Hex$="123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; Null weglassen
; S$=UCase(S$) ; Nachtrag, damit auch kleine Buchstaben als große erkannt werden
m.l=Len(S$)
i.l=0
q.q
q=0
While Not(i=m)
Dings= Pow(Basis,i)
i+1
q=q+FindString(Hex$,Left(Right(S$,i),1),1)*Dings ; direkt * Pow(Basis, i-1) ist nicht möglich
Wend
ProcedureReturn q
EndProcedure
Procedure.s StrX(Zahl.q,Basis.b)
k.s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
F.s="0"
If Zahl=0
F="0"
Else
F = "";
EndIf
While Zahl <> 0
F = Mid(k ,(Zahl % Basis)+1,1)+F;
Zahl = Zahl / Basis;
Wend;
ProcedureReturn F
EndProcedure
;/ Beispiele:
Debug ValX("11111111",2)
Debug ValX("FF",16)
Debug StrX(255,2)
Debug StrX(255,16)
Debug ValX("10",10)
Debug StrX(10,10)
http://www.purebasic.fr/german/viewtopi ... lensysteme
http://www.purebasic.fr/german/viewtopi ... lensysteme
Hoffe, es nützt wem. Wenn man die Strings "01523456 ..."
ändert, kann man damit theorethisch auch verschlüsseln

q=q+FindString(Hex$,Left(Right(S$,i),1),1) * Pow(Basis,i-1)
Code: Alles auswählen
While Not(i=m)
i+1
q=q+FindString(Hex$,Left(Right(S$,i),1),1)*Pow(Basis,i-1)
Wend
Begehe ich da einen Fehler, oder liegt der Fehler wo anders?
Code: Alles auswählen
While Not(i=m)
i+1
Dings.q= Pow(Basis,i-1)
q=q+FindString(Hex$,Left(Right(S$,i),1),1)*Dings ; direkt * Pow(Basis, i-1) ist nicht möglich
Wend
