home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 20
/
020.d81
/
t.scrambler
< prev
next >
Wrap
Text File
|
2022-08-26
|
3KB
|
188 lines
Scrambler
Written by: Bruce Jaeger
Scrambler is a handy little
machine-language utility that allows
you to scramble and unscramble (i.e.
encipher and decipher) your data
strings. Familiar to all of us is the
subsitution method, for example, all
A's become Z's; etc., however
Scrambler uses a method that is a
little more clever--the transposition
method.
A transposition cipher hides the
message by rearranging the letters in
a predetermined sequence and reveals
that same message by reversing the
process. For an example, consider the
following:
If our message is 'WE WILL MEET AT
12:00 NOON,' we might arrange the text
as shown below.
W E W I L
L M E E T
A T 1 2 :
0 0 N O O
N E E E E
(The extra E's on the end are padded
to make an even matrix.)
With this method, our text would
read, 'WLA0N EMT0E WE1NE IE2OE LT:OE.'
Scrambler transposes text a
character string at a time. The
maximum length is 255 characters and
these characters may be of any type
(e.g. alphanumeric, color codes,
cursor commands, etc.). The keyword
used to encipher a message can be of
any length between 1 and 255,
inclusive.
When RUN, Scrambler pokes a machine
language routine in memory starting
at 49152 ($C000). Memory at 49664-
49919 ($C200-$C2FF) is used for
workspace, so be sure not to store
any other routines there.
Within your programs, Scrambler is
called using the following format:
SYS(49152),X,KEY$,TEXT$
where X equals a zero to encode a
message; or X equals a one to decode
a message.
KEY$ contains the keyword. If the
keyword is "dog", then Scrambler will
transpose the message four times,
once using the ASCII value of each
character of the keyword, plus a
final time using the sum of the
characters' values. Remember that the
keyword must be at least one
character long.
Initially, TEXT$ contains the
message to be scrambled. After the
message has been scrambled, TEXT$
will contain the scrambled message.
The names of the variable strings
are not important, as long as they
are arranged correctly (i.e. they are
in the correct position in the SYS
statement).
There are two Scrambler demos on
this issue of LOADSTAR. If you choose
to RUN Scrambler, you will be given a
small menu from which you can choose
either demo.
If running Scrambler outside of the
LOADSTAR environment, then you first
need to LOAD and RUN 'SCRAMBLER.LOAD'.
This program pokes in the machine
language routine.
------
This program is copyrighted by
Commodore Microcomputers magazine.
All rights to it are reserved.
LOADSTAR has relieved you from the
burden of keying in this program.
For more complete information about
this program, refer to the February
1986 issue of Commodore
Microcomputers.
>Files used: SCRAMBLER <==menu
SCRAMBLER.LOAD <==pokes
SCRAMBLE.49152
SCRAMBLER DEMO1
SCRAMBLER DEMO2
--------< end of article >------------