I decided to follow the advice.  I implemented the very famous (and simple)
sysmetric-key encryption scheme (too bad I forget the name of it).  It is
theoreticaly unbreakable (in ideal conditions) if the key is long enough and
the data is truely random.

Max

// Encryption with a ascii string KEY with null-termination
// The source and encrypted data have same length: len
// Set encrypt to true to encrypt, false to decrypt
Err MyEnc(UInt8 *src, UInt8 *des, UInt8 *key, UInt16 len, Boolean encrypt)
{   
    UInt8 *srcP, *keyP, *desP;
    UInt16 count=len;
    Int16 tmp;

    srcP=src; keyP=key; desP=des;
    if(*keyP == '\0') return 1; // zero key length
    while(count) {
        if (*keyP == '\0')
            keyP = key;
        if(encrypt) {
            tmp = *srcP + *keyP;
            if(tmp > 255)
                tmp -= 256;
        } else {
            tmp = *srcP - *keyP;
            if(tmp < 0)
                tmp += 256;
        }
        *desP = (UInt8)tmp;
        count--; srcP++; desP++; keyP++;
    }
    return 0;
}



--- Joe Programmer <[EMAIL PROTECTED]> wrote:

> However, it would be better to heed Keith's advice and
> not use unsupported functions which could disappear
> with any new ROM release.


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to