| |
|
|
Michael Wodrich | The from some Mail-Programs and NewsReadern known ROT13-Verschlüsselung. not as good Verschlüsselung virtual, separate circa Texts temporarily To hide. Z.B. if over soccer-Results chat becomes its radiation first on the evening results. or someone has a TV-series already in america seen and wants above diskutieren. with ROT13 hidden is it each freigestellt, itself self whom Fun To spoil and the Text To reading or rather To Waiting. CompileMarkSeparationXProfan 9 (lokaler Bereich, Operatoren)
Autor: Michael Wodrich
Def InRange(3) If((@&(1) >= @&(2)) and (@&(1) <= @&(3)),1,0)
Def InRangeEx(3) If((@&(1) > @&(2)) and (@&(1) < @&(3)),1,0)
Die aus Mail-Programmen bekannte ROT13-Verschlüsselung.
Zweimalige Anwendung entschlüsselt den Text wieder.
Proc Rot13$
Parameters Text$
Declare Erg$,Buf#,Anz%,c%
Let Anz% = Len(Text$) Länge wird mehrmals benötigt
Dim Buf#,Anz% + 1
String Buf#,0 = Text$
WhileLoop 0,Anz%
Let c% = Byte(Buf#,&loop)
If InRange(c%,65,77) or InRange(c%,97,109) A..M, a..m
Byte Buf#,&loop = c% + 13
ElseIf InRange(c%,78,90) or InRange(c%,110,122) N..Z, n..z
Byte Buf#,&loop = c% - 13
EndIf
EndWhile
Let Erg$ = String$(Buf#,0)
Dispose Buf#
Return Erg$
EndProc
cls
print ""
print Rot13$("Qvrf vfg rva Grfg.")
print ""
print Rot13$("Qvr nhf Znvy-Cebtenzzra orxnaagr EBG13-Irefpuyüffryhat.")
print Rot13$("Mjrvznyvtr Najraqhat ragfpuyüffryg qra Grkg jvrqre.")
print ""
print Rot13$("Ahe mhz rvasnpura ireoretra. Nyf Irefpuyüffryhat hatrrvtarg!")
WaitKey
end
Best wishes Michael Wodrich |
|
|
| Programmieren, das spannendste Detektivspiel der Welt. | 09/19/05 ▲ |
|
|
|
|
Michael W. | the goes naturally something kompakter...
there have I The logischen And and Or uses. And: && Or: ||
leaves itself means too on The 11it Version adjust.
// Author: Michael Wodrich
Proc ruddy13
Parameters string s
Declare string res, int c
WhileLoop 1,Len(s)
// c = ord(mid$(s,&loop,1))
c = ord(substr$(s,&loop))
res = res + Chr$(if(((c > 64) && (c < 78)) || ((c > 96) && (c < 110)), c + 13, if(((c > 77) && (c < 91)) || ((c > 109) && (c < 123)), c - 13, c )))
EndWhile
Return res
ENDPROC
cls
Declare x$
x$ = "Test abc,123"
Print " Original:",x$
x$ = ruddy13(x$)
Print "encode ruddy13:",x$
x$ = ruddy13(x$)
Print "decode ruddy13:",x$
print ""
print ruddy13("Qvrf vfg rva Grfg.")
print ""
print ruddy13("Qvr nhf Znvy-Cebtenzzra orxnaagr EBG13-Irefpuyüffryhat.")
print ruddy13("Mjrvznyvtr Najraqhat ragfpuyüffryg qra Grkg jvrqre.")
print ""
print ruddy13("Ahe mhz rvasnpura ireoretra. Nyf Irefpuyüffryhat hatrrvtarg!")
WaitKey
end
|
|
|
| |
|
|