|
guito <guito@guito.dhs.org> wrote:
> Geoffrey Hyde <ghyde@fastinternet.net.au> wrote:
> > Which reminds me, I must find out if some program HAS a ROT13 decoder!!
> slrn does. :)
Netscape's newsreader used to be able to, but I just looked, and they seem
to have taken it out, or at least moved it.
Of course, there's always:
#!/usr/bin/perl
foreach ('a'..'m', 'A'..'M') {
$q = chr(ord($_)+13);
$p{$_} = $q; $p{$q} = $_;
}
while (<>) { s#(.)#$p{$1}#g; print; }
or
#!/usr/bin/python
import sys
def main():
text = sys.stdin.read()
for x in range(len(text)):
byte = ord(text[x])
cap = (byte & 32)
byte = (byte & (~cap))
if (byte >= ord('A')) and (byte <= ord('Z')):
byte = ((byte - ord('A') + 13) % 26 + ord('A'))
byte = (byte | cap)
sys.stdout.write(chr(byte))
main()
or even
DECLARE FUNCTION Rot13$ (S AS STRING)
DIM S AS STRING
INPUT "", S
WHILE S <> ""
PRINT Rot13$(S)
INPUT "", S
WEND
FUNCTION Rot13$ (S AS STRING)
DIM I, J AS INTEGER
DIM T AS STRING
FOR I = 1 TO LEN(S)
J = ASC(MID$(S, I, 1))
IF J >= 65 AND J <= 90 THEN
J = ((J - 52) MOD 26) + 65
ELSEIF J >= 97 AND J <= 122 THEN
J = ((J - 84) MOD 26) + 97
END IF
T = T + CHR$(J)
NEXT I
Rot13$ = T
END FUNCTION
(all from http://ucsub.colorado.edu/~kominek/rot13/)
--
Matthew Miller ---> mattdm@mattdm.org
Quotes 'R' Us ---> http://quotes-r-us.org/
Boston University Linux ---> http://linux.bu.edu/
|
|
Message has 2 Replies:
Message is in Reply To:
30 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|