2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,31 +1,29 @@
/*REXX program encrypts uppercased text using the Vigenère cypher. */
/*REXX program encrypts (and displays) uppercased text using the Vigenère cypher.*/
@.1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
L=length(@.1)
do j=2 to L; jm=j-1; q=@.jm
@.j=substr(q,2,L-1)left(q,1)
do j=2 to L; jm=j-1; q=@.jm
@.j=substr(q, 2, L-1)left(q, 1)
end /*j*/
cypher = space('WHOOP DE DOO NO BIG DEAL HERE OR THERE',0)
cypher = space('WHOOP DE DOO NO BIG DEAL HERE OR THERE', 0)
oMsg = 'People solve problems by trial and error; judgement helps pick the trial.'
oMsgU = oMsg; upper oMsgU
cypher_=copies(cypher,length(oMsg)%length(cypher))
cypher_= copies(cypher, length(oMsg) % length(cypher) )
say ' original text =' oMsg
xMsg=Ncypher(oMsgU)
say ' cyphered text =' xMsg
bMsg=Dcypher(xMsg)
say 're-cyphered text =' bMsg
exit
/*───────────────────────────────Ncypher subroutine─────────────────────*/
Ncypher: parse arg stuff; #=1; nMsg=
do i=1 for length(stuff); x=substr(stuff,i,1) /*pick off 1 char.*/
if \datatype(x,'U') then iterate /*not a letter? Then ignore it.*/
j=pos(x,@.1); nMsg=nMsg || substr(@.j,pos(substr(cypher_,#,1),@.1),1)
#=#+1 /*bump the character counter. */
end
return nMsg
/*───────────────────────────────Dcypher subroutine──────────────────────*/
Dcypher: parse arg stuff; #=1; dMsg=
do i=1 for length(stuff); x=substr(cypher_,i,1) /*pick off 1 char.*/
j=pos(x,@.1); dMsg=dMsg || substr(@.1, pos(substr(stuff,i,1),@.j),1)
end
return dMsg
/*──────────────────────────────────────────────────────────────────────────────────────*/
Ncypher: parse arg x; nMsg=; #=1 /*unsupported char? ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
do i=1 for length(x); j=pos(substr(x,i,1), @.1); if j==0 then iterate
nMsg=nMsg || substr(@.j, pos( substr( cypher_, #, 1), @.1), 1); #=#+1
end /*j*/
return nMsg
/*──────────────────────────────────────────────────────────────────────────────────────*/
Dcypher: parse arg x; dMsg=
do i=1 for length(x); j=pos(substr(cypher_, i, 1), @.1)
dMsg=dMsg || substr(@.1, pos( substr(x, i, 1), @.j), 1)
end /*j*/
return dMsg

View file

@ -1,30 +1,29 @@
/*REXX program encrypts uppercased text using the Vigenère cypher. */
@abc='abcdefghijklmnopqrstuvwxyz'; @abcU=@abc; upper @abcU
/*REXX program encrypts (and displays) most text using the Vigenère cypher. */
@abc= 'abcdefghijklmnopqrstuvwxyz'; @abcU=@abc; upper @abcU
@.1 = @abcU || @abc'0123456789~`!@#$%^&*()_-+={}|[]\:;<>?,./" '''
L=length(@.1)
do j=2 to length(@.1); jm=j-1; q=@.jm
@.j=substr(q,2,length(@.1)-1)left(q,1)
do j=2 to length(@.1); jm=j-1; q=@.jm
@.j=substr(q, 2, L-1)left(q, 1)
end /*j*/
cypher = space('WHOOP DE DOO NO BIG DEAL HERE OR THERE',0)
cypher = space('WHOOP DE DOO NO BIG DEAL HERE OR THERE', 0)
oMsg = 'Making things easy is just knowing the shortcuts. --- Gerard J. Schildberger'
cypher_=copies(cypher,length(oMsg)%length(cypher))
cypher_= copies(cypher, length(oMsg) % length(cypher) )
say ' original text =' oMsg
xMsg=Ncypher(oMsg)
say ' cyphered text =' xMsg
bMsg=Dcypher(xMsg)
say 're-cyphered text =' bMsg
exit
/*───────────────────────────────Ncypher subroutine─────────────────────*/
Ncypher: parse arg stuff; #=1; nMsg=
do i=1 for length(stuff); x=substr(stuff,i,1) /*pick off 1 char.*/
j=pos(x,@.1); if j==0 then iterate /*character not supported? Ignore*/
nMsg=nMsg || substr(@.j,pos(substr(cypher_,#,1),@.1),1); #=#+1
end /*j*/
return nMsg
/*───────────────────────────────Dcypher subroutine──────────────────────*/
Dcypher: parse arg stuff; #=1; dMsg=
do i=1 for length(stuff); x=substr(cypher_,i,1) /*pick off 1 char.*/
j=pos(x,@.1); dMsg=dMsg || substr(@.1, pos(substr(stuff,i,1),@.j),1)
end /*j*/
return dMsg
/*──────────────────────────────────────────────────────────────────────────────────────*/
Ncypher: parse arg x; nMsg=; #=1 /*unsupported char? ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
do i=1 for length(x); j=pos(substr(x,i,1), @.1); if j==0 then iterate
nMsg=nMsg || substr(@.j, pos( substr( cypher_, #, 1), @.1), 1); #=#+1
end /*j*/
return nMsg
/*──────────────────────────────────────────────────────────────────────────────────────*/
Dcypher: parse arg x; dMsg=
do i=1 for length(x); j=pos(substr(cypher_, i, 1), @.1)
dMsg=dMsg || substr(@.1, pos( substr(x, i, 1), @.j), 1)
end /*j*/
return dMsg