Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,40 +0,0 @@
with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Command_Line; use Ada.Command_Line;
procedure Rot_13 is
From_Sequence : Character_Sequence := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
Result_Sequence : Character_Sequence := "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM";
Rot_13_Mapping : Character_Mapping := To_Mapping(From_Sequence, Result_Sequence);
In_Char : Character;
Stdio : Stream_Access := Stream(Ada.Text_IO.Standard_Input);
Stdout : Stream_Access := Stream(Ada.Text_Io.Standard_Output);
Input : Ada.Text_Io.File_Type;
begin
if Argument_Count > 0 then
for I in 1..Argument_Count loop
begin
Ada.Text_Io.Open(File => Input, Mode => Ada.Text_Io.In_File, Name => Argument(I));
Stdio := Stream(Input);
while not Ada.Text_Io.End_Of_File(Input) loop
In_Char :=Character'Input(Stdio);
Character'Output(Stdout, Value(Rot_13_Mapping, In_Char));
end loop;
Ada.Text_IO.Close(Input);
exception
when Ada.Text_IO.Name_Error =>
Ada.Text_Io.Put_Line(File => Ada.Text_Io.Standard_Error, Item => "File " & Argument(I) & " is not a file.");
when Ada.Text_Io.Status_Error =>
Ada.Text_Io.Put_Line(File => Ada.Text_Io.Standard_Error, Item => "File " & Argument(I) & " is already opened.");
end;
end loop;
else
while not Ada.Text_Io.End_Of_File loop
In_Char :=Character'Input(Stdio);
Character'Output(Stdout, Value(Rot_13_Mapping, In_Char));
end loop;
end if;
end Rot_13;

View file

@ -1,8 +1,10 @@
rot13: function [c][
case [in? lower c]
when? -> `a`..`m` -> return to :char (to :integer c) + 13
when? -> `n`..`z` -> return to :char (to :integer c) - 13
else -> return c
lc: lower c
when.has: lc [
[|in? 'a'..'m'] -> return to :char (to :integer c) + 13
[|in? 'n'..'z'] -> return to :char (to :integer c) - 13
true -> return c
]
]
loop "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 'ch

View file

@ -1,47 +0,0 @@
@echo off & setlocal enabledelayedexpansion
:: ROT13 obfuscator Michael Sanders - 2017
::
:: example: rot13.cmd Rire abgvpr cflpuvpf arire jva gur ybggrel?
:setup
set str=%*
set buf=%str%
set len=0
:getlength
if not defined buf goto :start
set buf=%buf:~1%
set /a len+=1
goto :getlength
:start
if %len% leq 0 (echo rot13: zero length string & exit /b 1)
set abc=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
set nop=NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm
set r13=
set num=0
set /a len-=1
:rot13
for /l %%x in (!num!,1,%len%) do (
set log=0
for /l %%y in (0,1,51) do (
if "!str:~%%x,1!"=="!abc:~%%y,1!" (
call set r13=!r13!!nop:~%%y,1!
set /a num=%%x+1
set /a log+=1
if !num! lss %len% goto :rot13
)
)
if !log!==0 call set r13=!r13!!str:~%%x,1!
)
:done
echo !r13!
endlocal & exit /b 0

View file

@ -1,19 +0,0 @@
FORMAT IDENTIFICATION DIVISION.
PROGRAM-ID. rot-13.
DATA DIVISION.
LINKAGE SECTION.
77 in-str PIC X(100).
77 out-str PIC X(100).
PROCEDURE DIVISION USING BY REFERENCE in-str, out-str.
MOVE in-str TO out-str
INSPECT out-str
CONVERTING "abcdefghijklmnopqrstuvwxyz"
TO "nopqrstuvwxyzabcdefghijklm"
INSPECT out-str
CONVERTING "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
TO "NOPQRSTUVWXYZABCDEFGHIJKLM"
EXIT PROGRAM.
END PROGRAM rot-13.

View file

@ -1,21 +0,0 @@
IDENTIFICATION DIVISION.
FUNCTION-ID. rot-13.
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 STR-LENGTH CONSTANT AS 100.
01 normal-lower CONSTANT AS "abcdefghijklmnopqrstuvwxyz".
01 rot13-lower CONSTANT AS "nopqrstuvwxyzabcdefghijklm".
01 normal-upper CONSTANT AS "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
01 rot13-upper CONSTANT AS "NOPQRSTUVWXYZABCDEFGHIJKLM".
LINKAGE SECTION.
77 in-str PICTURE IS X(STR-LENGTH).
77 out-str PICTURE IS X(STR-LENGTH).
PROCEDURE DIVISION USING in-str, RETURNING out-str.
MOVE in-str TO out-str
INSPECT out-str CONVERTING normal-lower TO rot13-lower
INSPECT out-str CONVERTING normal-upper TO rot13-upper
GOBACK.
END FUNCTION rot-13.

View file

@ -22,10 +22,10 @@ singleton rotConvertor
= s.selectBy::(ch => rotConvertor.convert(ch)).summarize(new StringWriter());
}
public program()
public Program()
{
if (program_arguments.Length > 1)
if (Program_arguments.Length > 1)
{
console.printLine(rotConvertor.convert(program_arguments[1]))
Console.printLine(rotConvertor.convert(program_arguments[1]))
}
}

View file

@ -1,5 +0,0 @@
(rot13-string "abc") ;=> "nop"
(with-temp-buffer
(insert "abc")
(rot13-region (point-min) (point-max))
(buffer-string)) ;=> "nop"

View file

@ -1,15 +0,0 @@
(defun rot-13 (string)
(let* ((len (length string))
(output (make-string len ?\s)))
(dotimes (i len)
(let ((char (aref string i)))
(cond
((or (and (>= char ?n) (<= char ?z))
(and (>= char ?N) (<= char ?Z)))
(aset output i (- char 13)))
((or (and (>= char ?a) (<= char ?m))
(and (>= char ?A) (<= char ?M)))
(aset output i (+ char 13)))
(t
(aset output i char)))))
output))

View file

@ -1,39 +0,0 @@
include std/types.e
include std/text.e
atom FALSE = 0
atom TRUE = not FALSE
function Rot13( object oStuff )
integer iOffset
integer bIsUpper
object oResult
sequence sAlphabet = "abcdefghijklmnopqrstuvwxyz"
if sequence(oStuff) then
oResult = repeat( 0, length( oStuff ) )
for i = 1 to length( oStuff ) do
oResult[ i ] = Rot13( oStuff[ i ] )
end for
else
bIsUpper = FALSE
if t_upper( oStuff ) then
bIsUpper = TRUE
oStuff = lower( oStuff )
end if
iOffset = find( oStuff, sAlphabet )
if iOffset != 0 then
iOffset += 13
iOffset = remainder( iOffset, 26 )
if iOffset = 0 then iOffset = 1 end if
oResult = sAlphabet[iOffset]
if bIsUpper then
oResult = upper(oResult)
end if
else
oResult = oStuff --sprintf( "%s", oStuff )
end if
end if
return oResult
end function
puts( 1, Rot13( "abjurer NOWHERE." ) & "\n" )

View file

@ -1,11 +0,0 @@
public static function rot13(input: String): String {
var buf = new StringBuf();
for (charInt in new haxe.iterators.StringIterator(input)) {
if (charInt >= 0x41 && charInt <= 0x4d || charInt >= 0x61 && charInt <= 0x6d)
charInt += 13;
else if (charInt >= 0x4e && charInt <= 0x5a || charInt >= 0x6e && charInt <= 0x7a)
charInt -= 13;
buf.addChar(charInt);
}
return buf.toString();
}

View file

@ -1,3 +0,0 @@
$e = "This is a test Guvf vf n grfg"
[char[]](0..64+78..90+65..77+91..96+110..122+97..109+123..255)[[char[]]$e] -join ""

View file

@ -1,41 +0,0 @@
function Invoke-Rot13 {
param(
[char[]]$message
)
begin {
$outString = New-Object System.Collections.ArrayList
$alpha = 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
$alphaL = $alpha + $alpha
$alphaU = $alphaL.toUpper()
$int = 13
}
process{
$message | ForEach-Object {
# test if char is special
if ($_ -match '[^\p{L}\p{Nd}]') {
$outString += $_
}
# test if char is digit
elseif ($_ -match '\d') {
$outString += $_
}
# test if char is upperCase
elseif ($_ -ceq $_.ToString().ToUpper()) {
$charIndex = $alphaU.IndexOf($_.tostring())
$outString += $alphaU[$charIndex+$int]
}
# test if char is lowerCase
elseif ($_ -ceq $_.ToString().ToLower()) {
$charIndex = $alphaL.IndexOf($_.tostring())
$outString += $alphaL[$charIndex+$int]
}
else {
$outString += $_
}
} # end foreach
} # end process
end {
# output string and join all chars
$outString -join ""
}
} # end function

View file

@ -1,6 +0,0 @@
PS> $message = '{!This is /A\ Test123}'
PS> $messageE = Invoke-Rot13 -message $message
PS> $messageE
PS> Invoke-Rot13 -message $messageE
{!Guvf vf /N\ Grfg123}
{!This is /A\ Test123}

View file

@ -1,82 +0,0 @@
REBOL [
Title: "Rot-13"
URL: http://rosettacode.org/wiki/Rot-13
]
; Test data has upper and lower case characters as well as characters
; that should not be transformed, like numbers, spaces and symbols.
text: "This is a 28-character test!"
print "Using cipher table:"
; I build a set of correspondence lists here. 'x' is the letters from
; A-Z, in both upper and lowercase form. Note that REBOL can iterate
; directly over the alphabetic character sequence in the for loop. 'y'
; is the cipher form, 'x' rotated by 26 characters (remember, I have
; the lower and uppercase forms together). 'r' holds the final result,
; built as I iterate across the 'text' string. I search for the
; current character in the plaintext list ('x'), if I find it, I get
; the corresponding character from the ciphertext list
; ('y'). Otherwise, I pass the character through untransformed, then
; return the final string.
rot-13: func [
"Encrypt or decrypt rot-13 with tables."
text [string!] "Text to en/decrypt."
/local x y r i c
] [
x: copy "" for i #"a" #"z" 1 [append x rejoin [i uppercase i]]
y: rejoin [copy skip x 26 copy/part x 26]
r: copy ""
repeat i text [append r either c: find/case x i [y/(index? c)][i]]
r
]
; Note that I am setting the 'text' variable to the result of rot-13
; so I can reuse it again on the next call. The rot-13 algorithm is
; reversible, so I can just run it again without modification to decrypt.
print [" Encrypted:" text: rot-13 text]
print [" Decrypted:" text: rot-13 text]
print "Using parse:"
clamp: func [
"Contain a value within two enclosing values. Wraps if necessary."
x v y
][
x: to-integer x v: to-integer v y: to-integer y
case [v < x [y - v] v > y [v - y + x - 1] true v]
]
; I'm using REBOL's 'parse' word here. I set up character sets for
; upper and lower-case letters, then let parse walk across the
; text. It looks for matches to upper-case letters, then lower-case,
; then skips to the next one if it can't find either. If a matching
; character is found, it's mathematically incremented by 13 and
; clamped to the appropriate character range. parse changes the
; character in place in the string, hence this is a destructive
; operation.
rot-13: func [
"Encrypt or decrypt rot-13 with parse."
text [string!] "Text to en/decrypt. Note: Destructive!"
] [
u: charset [#"A" - #"Z"]
l: charset [#"a" - #"z"]
parse text [some [
i: ; Current position.
u (i/1: to-char clamp #"A" i/1 + 13 #"Z") | ; Upper case.
l (i/1: to-char clamp #"a" i/1 + 13 #"z") | ; Lower case.
skip]] ; Ignore others.
text
]
; As you see, I don't need to re-assign 'text' anymore.
print [" Encrypted:" rot-13 text]
print [" Decrypted:" rot-13 text]

View file

@ -1,26 +0,0 @@
option explicit
function rot13(a)
dim b,n1,n,i
b=""
for i=1 to len(a)
n=asc(mid(a,i,1))
if n>=65 and n<= 91 then
n1=(((n-65)+13)mod 26)+65
elseif n>=97 and n<= 123 then
n1=(((n-97)+13)mod 26)+97
else
n1=n
end if
b=b & chr(n1)
next
rot13=b
end function
const a="The quick brown fox jumps over the lazy dog."
dim b,c
wscript.echo a
b=rot13(a)
wscript.echo b
c=rot13(b)
wscript.echo c