Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
25
Task/Rot-13/CBASIC/rot-13.basic
Normal file
25
Task/Rot-13/CBASIC/rot-13.basic
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
rem Return the ROT13 transformation of s$, preserving case \
|
||||
and passing non-alphabetic characters without change
|
||||
|
||||
def fn.rot13$(s$)
|
||||
normal$ ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
rotated$="NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"
|
||||
outstr$ = ""
|
||||
for i% = 1 to len(s$)
|
||||
c$ = mid$(s$,i%,1)
|
||||
k% = match(c$,normal$,1)
|
||||
if k% <> 0 then c$ = mid$(rotated$,k%,1)
|
||||
outstr$ = outstr$ + c$
|
||||
next i%
|
||||
fn.rot13$ = outstr$
|
||||
return
|
||||
fend
|
||||
|
||||
plain$ = "The quick brown fox jumps over the lazy dog."
|
||||
encoded$ = fn.rot13$(plain$)
|
||||
|
||||
print "Plain Text: "; plain$
|
||||
print "Encoded : "; encoded$
|
||||
print "Restored : "; fn.rot13$(encoded$)
|
||||
|
||||
end
|
||||
58
Task/Rot-13/Ed/rot-13.ed
Normal file
58
Task/Rot-13/Ed/rot-13.ed
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
H
|
||||
,p
|
||||
g/([[:alpha:]])/s// \1 /g
|
||||
g/[ ]a[ ]/s//%n%/g
|
||||
g/[ ]b[ ]/s//%o%/g
|
||||
g/[ ]c[ ]/s//%p%/g
|
||||
g/[ ]d[ ]/s//%q%/g
|
||||
g/[ ]e[ ]/s//%r%/g
|
||||
g/[ ]f[ ]/s//%s%/g
|
||||
g/[ ]g[ ]/s//%t%/g
|
||||
g/[ ]h[ ]/s//%u%/g
|
||||
g/[ ]i[ ]/s//%v%/g
|
||||
g/[ ]j[ ]/s//%w%/g
|
||||
g/[ ]k[ ]/s//%x%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]/s//%M%/g
|
||||
g/%([[:alpha:]])%/s//\1/g
|
||||
,p
|
||||
Q
|
||||
9
Task/Rot-13/Nu/rot-13.nu
Normal file
9
Task/Rot-13/Nu/rot-13.nu
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
let map = (
|
||||
seq char A Z | zip (seq char a z) | flatten
|
||||
| into record | [$in $in] | headers | first
|
||||
| roll left -c -b 26
|
||||
)
|
||||
|
||||
def rot13 [] {
|
||||
split chars | each {|c| $map | get -i -s $c | default $c } | str join
|
||||
}
|
||||
22
Task/Rot-13/OmniMark/rot-13.xom
Normal file
22
Task/Rot-13/OmniMark/rot-13.xom
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
; rot-13.xom
|
||||
global stream gs-phrase
|
||||
|
||||
define stream function apply-rot-13 (value stream phrase) as
|
||||
local integer b
|
||||
local stream ciphered
|
||||
open ciphered as buffer
|
||||
repeat scan phrase
|
||||
match letter => char
|
||||
set b to char binary 0
|
||||
increment b by 13
|
||||
decrement b by 26 when char matches uc and b > 90
|
||||
decrement b by 26 when char matches lc and b > 122
|
||||
put ciphered "b" % b
|
||||
match any => char
|
||||
put ciphered char
|
||||
again
|
||||
close ciphered
|
||||
return ciphered
|
||||
|
||||
process
|
||||
output apply-rot-13(gs-phrase)
|
||||
188
Task/Rot-13/X86-64-Assembly/rot-13.x86-64
Normal file
188
Task/Rot-13/X86-64-Assembly/rot-13.x86-64
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
global _start
|
||||
|
||||
section .text
|
||||
|
||||
%define bsize 24
|
||||
%define fd(w) qword[filedescriptor + w * 8]
|
||||
%define sv(w) qword[rsp + w * 8]
|
||||
|
||||
_start:
|
||||
mov fd(0), -1
|
||||
mov fd(1), -1
|
||||
pop r15
|
||||
cmp r15, 1
|
||||
jle .stdio0
|
||||
dec r15
|
||||
add rsp, 8
|
||||
xor r14, r14
|
||||
.readcmd:
|
||||
cmp r14, r15
|
||||
jge .checkfd
|
||||
mov r13, sv(r14)
|
||||
cmp dword[r13], `-if\0`
|
||||
je .setif
|
||||
cmp dword[r13], `-of\0`
|
||||
je .setof
|
||||
cmp word[r13], "-h"
|
||||
je .usage
|
||||
jmp .readcmd
|
||||
.stdio0:
|
||||
mov fd(0), 0
|
||||
mov fd(1), 1
|
||||
jmp .checkfd
|
||||
.setif:
|
||||
xor rax, rax
|
||||
inc r14
|
||||
cmp r14, r15
|
||||
je .checkfd
|
||||
mov rdi, sv(r14)
|
||||
cmp dword[rdi], "stdi"
|
||||
je .stif
|
||||
mov rax, 2
|
||||
mov rsi, 0
|
||||
mov rdx, 0
|
||||
syscall
|
||||
.stif:
|
||||
mov fd(0), rax
|
||||
inc r14
|
||||
jmp .readcmd
|
||||
.setof:
|
||||
mov rax, 1
|
||||
inc r14
|
||||
cmp r14, r15
|
||||
jge .checkfd
|
||||
mov rdi, sv(r14)
|
||||
cmp dword[rdi], "stdo"
|
||||
je .stof
|
||||
mov rax, 85
|
||||
mov rsi, 0o644
|
||||
syscall
|
||||
.stof:
|
||||
mov fd(1), rax
|
||||
inc r14
|
||||
jmp .readcmd
|
||||
.checkfd:
|
||||
cmp fd(0), -1
|
||||
jne .cfd0
|
||||
mov fd(0), 0
|
||||
.cfd0:
|
||||
cmp fd(0), -1
|
||||
jl .err0
|
||||
cmp fd(1), -1
|
||||
jne .cfd1
|
||||
cmp fd(0), -1
|
||||
jl .err1
|
||||
mov fd(1), 1
|
||||
.cfd1:
|
||||
.readwrite:
|
||||
sub rsp, 8
|
||||
.read:
|
||||
xor rax, rax
|
||||
mov rdi, fd(0)
|
||||
mov rsi, rsp
|
||||
mov rdx, 1
|
||||
syscall
|
||||
or rax, rax
|
||||
jz .close0
|
||||
.rot13_:
|
||||
mov dil, byte[rsp]
|
||||
call rot13byte
|
||||
mov qword[rsp], rax
|
||||
.write:
|
||||
mov rax, 1
|
||||
mov rdi, fd(1)
|
||||
mov rsi, rsp
|
||||
mov rdx, 1
|
||||
syscall
|
||||
or rax, rax
|
||||
js .close0
|
||||
jmp .read
|
||||
.close0:
|
||||
add rsp, 8
|
||||
cmp fd(0), 2
|
||||
jle .close1
|
||||
mov rax, 3
|
||||
mov rdi, fd(0)
|
||||
syscall
|
||||
.close1:
|
||||
cmp fd(1), 2
|
||||
jle .exit0
|
||||
mov rax, 3
|
||||
mov rdi, fd(1)
|
||||
syscall
|
||||
.exit0:
|
||||
mov rax, 60
|
||||
mov rdi, 0
|
||||
syscall
|
||||
.usage:
|
||||
mov rax, 1
|
||||
mov rdi, 1
|
||||
mov rsi, umsg
|
||||
mov rdx, endumsg - umsg
|
||||
syscall
|
||||
jmp .exit0
|
||||
.err0:
|
||||
mov rax, 1
|
||||
mov rdi, 1
|
||||
mov rsi, e0
|
||||
mov rdx, ende0 - e0
|
||||
syscall
|
||||
jmp .close1
|
||||
.err1:
|
||||
mov rax, 1
|
||||
mov rdi, 1
|
||||
mov rsi, e1
|
||||
mov rdx, ende1 - e1
|
||||
syscall
|
||||
jmp .usage
|
||||
;------------------------------
|
||||
rot13byte:
|
||||
push rdi
|
||||
push rdx
|
||||
push rcx
|
||||
mov rcx, 26
|
||||
mov rax, rdi
|
||||
.testupper:
|
||||
cmp dil, 'A'
|
||||
jl .return0
|
||||
cmp dil, 'Z'
|
||||
jg .testlower
|
||||
.rotupper:
|
||||
sub rdi, 'A'
|
||||
add rdi, 13
|
||||
xor rdx, rdx
|
||||
mov rax, rdi
|
||||
div rcx
|
||||
mov rax, rdx
|
||||
add rax, 'A'
|
||||
jmp .return0
|
||||
.testlower:
|
||||
cmp dil, 'a'
|
||||
jl .return0
|
||||
cmp dil, 'z'
|
||||
jg .return0
|
||||
.rotlower:
|
||||
sub rdi, 'a'
|
||||
add rdi, 13
|
||||
xor rdx, rdx
|
||||
mov rax, rdi
|
||||
div rcx
|
||||
mov rax, rdx
|
||||
add rax, 'a'
|
||||
.return0:
|
||||
pop rcx
|
||||
pop rdx
|
||||
pop rdi
|
||||
ret
|
||||
|
||||
section .data
|
||||
umsg: db "Usage:", 0x0a
|
||||
db "rot13 [-if input_filename] [-of output_filename]", 0x0a
|
||||
endumsg:
|
||||
e0: db "Error opening input file!", 0x0a
|
||||
ende0:
|
||||
e1: db "Error opening output file!", 0x0a
|
||||
ende1:
|
||||
|
||||
section .bss
|
||||
filedescriptor resq 2
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
!yamlscript/v0
|
||||
|
||||
s =: set(nil).into('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
m =: drop(26 s).concat(take(26 s)).zipmap(s _)
|
||||
|
||||
defn main(s):
|
||||
say: map(\(m %1 %1) s).apply(str _)
|
||||
defn main(input='Hello, World!'):
|
||||
s =: set(\\A .. \\Z) + (\\a .. \\z)
|
||||
say: cycle(s).drop(13 * 2)
|
||||
.zipmap(s).escape(input)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue