Re: [stella] 7800 development

Subject: Re: [stella] 7800 development
From: "Frank Palazzolo" <palazzol@xxxxxxxx>
Date: Wed, 8 Aug 2001 23:42:25 -0400
Hey guys,

Woohoo! - I'm generating 7800 signatures now in a C++ program!  Keith, 
your formula was almost perfect, I just fixed it by following the analysis on 
page 6 and 7 in that paper I cited earlier.  I've attached my code as it is, for 
reference.

BTW, I'm using the library "Crypto++", which has all the algorithms you'd 
ever need.  I don't have the 7800 checksum algorithm integrated into it yet.  
I've only tested it on Pole Position but it seems to be correct.

All those numbers in the Atari ST program come from p and q.
p and q were chosen with the following properties:

p and q must be prime
p (mod 4) = 3
q (mod 4) = 3

of course...n = p*q

and...
pexp = (p+1)/4
qexp = (q+1)/4

ap and aq can be determined using something called the 
Chinese Remainder Theorem:
ap can be calculated based on ap (mod p) = 1, and ap (mod q) = 0 
aq can be calculated based on aq (mod p) = 0, and aq (mod q) = 1 

The only funny part is in the hash calculation.  The final step of setting of 
byte 4 to zero is not part of the hash algorithm.  It's just a little extra to trip 
you up.

So, it works like this:

Atari:
-------
Compute Full Hash of cart
	(as in MungeCart(), but do not set that byte to zero)
Use formula to compute sig from cart:

sig = [ap * (hash^((p+1)/4)(mod p))) + aq * ((hash^((q+1)/4))(mod q))](mod n)

Give the sig to the cart maker

Console:
-------------
Compute a hash from sig:
	sig_hash = (sig^2)(mod n)
Tweak hash before compare (set byte to zero)
Compute a hash from the cart
Tweak cart_hash before compare (set byte to zero)
Compare the two tweaked hashes.

-Frank


The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  a78sign.cpp
     Date:  8 Aug 2001, 23:42
     Size:  3887 bytes.
     Type:  Program-source

Attachment: a78sign.cpp
Description: Binary data

Current Thread