[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

105.0. "TOUGH encryption" by EXODUS::MARK () Sun Mar 31 1985 01:54

Below is a Vax-Basic program that scrambles any input to something quite
scrambled up.
I'd like to see if anyone here can figure out a reverse to this, as
none of my friend (nor I) can figure out a solution. Here are just two
examples of the output of this program:
Unencrypted: A  Encrypted: AN9CPG
Unencrypted: B  Encrypted: 7OETMF

Those are just two I know off the top of my head.  Here is the routine:

10 PRINT "Enter line";
20 INPUT TEXT$
40 GOSUB 29000
55 PRINT TEXT$;" encoded is ";X$
60 GOTO 10
29000 CHANGE TEXT$ TO X%
29005   FOR X% = X%(0%) +1% TO 3%
29006!
29010    X%(X%) = 2% * X%(X%-1%) - X%(X%-1%) / 11%  *  11%
29011!
29015    X%(X%) = X%(X%) - X%(X%) / 127%  *  127%
29016!
29020   NEXT X%
29021!
29025 X%(7%) = X%(0%)
29026!
29030 IF X%(0%) < 3%  THEN  X%(7%) = 3%
29031!
29035   FOR X% = 6%  TO  X%(7%) + 1%   STEP -1%
29040    X%(X%) = 127% - X%(7%-X%)
29041!
29045   NEXT X%
29046!
29050   FOR X% = 1%  TO  6%
29051!
29055    X%(8%) = 12% * ( (X%+1%) / 2%  +  1%) + (-1%) ^ X%
29056!
29060      FOR X1% = 1% TO 6%
29061!
29065       X%(X%) = 2% * X%(X%) + X%(X1%) - X%(X1%) / X%(8%)  *  X%(8%)
29066!
29070      NEXT X1%
29071!
29075    X%(X%) = X%(X%) + X% * X%(0%) + 101%
29076!
29080    X%(X%) = X%(X%) - X%(X%) / 36%  *  36%
29081!
29085    IF X%(X%) < 10% THEN X%(X%) = X%(X%) + 48% ELSE X%(X%) = X%(X%)+ 55%
29086!
29090   NEXT X%
29091!
29095 X$=""
29097 FOR Z%=1% TO 6%
29098 X$=X$+CHR$(X%(Z%))
29099 NEXT Z%
29100 RETURN
32767 END



Well, I wish anyone who attempts it good luck -- and if someone gets it,
would they PLEASE mail the routine to EXODUS::MARK
Also, please spread this message around to as many notefiles that
are appropriate for it.  Thank you very, VERY much, and again, good 
luck.

		<m>

T.RTitleUserPersonal
Name
DateLines
105.1FKPK::KONINGMon Apr 01 1985 20:3417
That's not an encryption, that's a one-way (or maybe two-way) hash.  Encryption
implies the ability to decrypt, and the ability to supply a key that changes
the plaintext->cyphertext mapping, neither of which you have here.

Is there some mathematical basis to this program, or is it just a random
algorithm?  Knuth's statement "random numbers should not be generated with
an algorithm chosen at random" applies as much or more so to encryption
or hash functions.  Does this algorithm have any desirable properties
that currently well-known/accepted hash functions (e.g. DES, Purdy) do not
have?

Sorry if I'm being overly picky on something that was just proposed as a
fun puzzle and not a serious piece of code.  The problem is that sometimes
toys are mistaken for serious code and make it into products, and afterwards
cause serious security problems.

	Paul
105.2BOOKIE::PARODIWed Apr 03 1985 17:037
The coding techniques used in this thing serve as a fine example of
encryption!  Using the same identifier (X%) for a scalar and an array...

tch tch

JP
105.3VIKING::WASSER_1Wed Apr 03 1985 18:598
	I am trying to convert this to 'C' but I can't find a
	manual for VAX BASIC.  What does the CHANGE <string> TO <array>
	do?  Does it store the string length in array[0]?  What
	gets put in the unused elements (if any) of the array?

			-John A. Wasser

		"Real hackers barf at algorithms described in BASIC"
105.4EXODUS::MARKThu Apr 04 1985 00:2521
Ok, the CHANGE takes the string, puts its length in X(0), and each
ascii character code of each character in the string and puts them
in X(y).  CHANGE may also be in the basic help file.

This algorhythm doesn't use random numbers at all.

The routine was not 'taken' from any product if that is what you mean. I
just stumbled upon it and couldn't figure it out.

I appreciate the effort you are putting in this.  I really hope to find
some way to undo it.  You will have to forgive my little knowledge of
encryption/algorhythms because this is the first time I really ever
saw something like this.   


		Again, thanks -- and keep up the good work

	<m>


105.5SMILEY::MUNYANThu Apr 04 1985 19:478
Can I ask where you got that... The company I used to work for used that
exact piece of code with the same variable names to produce database keys.

The original algorithm was based on an algo that appeared many years ago in
the communications of the ACM.  I remember using that code as far back as
1974.

Steve