"Mini-Crypto" Substitution Macro

5 views
Skip to first unread message

Phil Kane

unread,
Nov 13, 2009, 2:17:06 PM11/13/09
to TSEPro Support

Has anyone run across a macro that will do the following:

Given a "key-phrase", determine a group of characters (alpha
set) from that key-phrase for a given set of column numbers
(numerical set).

For instance:

The "key-phrase" is "Mary had a Little Lamb" (without quotation
marks), a phrase of 22 characters counting spaces. If the
numerical set is 6 15 9 1 20, the case-sensitive alpha set
would be "ht Ma" (again omitting the quotation marks). IIRC
the numerical set is less than 10 numbers.

Seems simple but then again so am I !

-- Phil Kane

Larry

unread,
Nov 13, 2009, 4:38:11 PM11/13/09
to sem...@googlegroups.com
/***
Here is a quick run at your question.

This macro includes two procedures which can be ececuted with the
assigned keys at the bottom.

The mTest() procedure simple produces the code you gave using the
keyphrase and numeric values you gave. It's a demo only.

The mReal() procedure allows you to enter the key phrase of choice, then
allows you to enter a series of numeric values. When you enter the last
numeric value you want, enter a -1 to finish. The macro then shows you
the code generated from the keyphrase using those numeric values.

Hope I understood your question. Several ways to improve the macro from
this.
***/
/*** Original message

For instance:

-- Phil Kane
***/

proc mTest()

string a[255]="Mary had a Little Lamb"
string b[255]=""
string c[255]=""
string d[255]=""

integer i=0
integer nt=0

if ask("Enter key phrase, ESC=Quit",a) and length(a)
repeat
// if asknumeric("Enter Numeric Pointers:, -1=Finished, ESC=Quit",b) and
val(b)<>-1
// c=c+","+b
// endif
c="6,15,9,1,20"
b="-1"
until b=="-1"
// evaluate c and produce code
nt=numtokens(c,",")
for i=1 to nt
d=d+a[val(gettoken(c,",",i)):1]
endfor
sound(9000,10)
warn("Generated Code: "+d)
else
sound(50,20)
warn("Cancelled.")
endif

end


proc mReal()

string a[255]="Mary had a Little Lamb"
string b[255]=""
string c[255]=""
string d[255]=""

integer i=0
integer n=0
integer nt=0

if ask("Enter key phrase, ESC=Quit",a) and length(a)
repeat
if asknumeric("Enter #:(1-"+str(length(a))+"), (So Far:"+c+"),
(-1=Finished, ESC=Quit",b)
and length(b)
if val(b)<>-1
and (val(b) in 1..length(a))
if c==""
c=b
else
c=c+","+b
endif
else
sound(20,6)
message("Out of Range Value...Skipped")
endif
else
sound(50,40)
warn("Cancelled.")
goto ending
endif
until b=="-1"
// evaluate c and produce code
nt=numtokens(c,",")
for i=1 to nt
n=val(gettoken(c,",",i))
if n<=length(a)
d=d+a[n:1]
endif
endfor
sound(9000,10)
warn("Generated Code: "+d)
else
sound(50,20)
warn("Cancelled.")
endif

goto ending
ending:

end

<ctrlshift x><t> mTest()
<ctrlshift x><r> mReal()

Jeff Howe

unread,
Nov 13, 2009, 5:19:07 PM11/13/09
to sem...@googlegroups.com
UNSUBSCRIBE

Reply all
Reply to author
Forward
0 new messages