--- Max Bian wrote:
> I found function EncDES in encrypt.h in the
> Core include directory. Has anyone
> tried it? Does it work at all? I couldn't
> find any ...
A google search for EncDES reveals that Greg Winton
discusses EncDES in his O'reilly book, "Palm OS
Network Programming - Writing Connected Applications
for the Palm" (which I haven't read).
And here is something posted at rudedog.org by Dave
Carrigan:
Off the top of my head and untested, here is a
function to encrypt or decrypt a string of
arbitrary length.
#include <Encrypt.h>
UInt8 *
crypt_string(UInt8 *plaintext, UInt8 *key, UInt16
bufsize, Boolean encrypt)
Char *outbuf;
UInt16 i;
outbuf = MemPtrNew(bufsize);
for (i=0; i < bufsize; i += 8) {
EncDES(&(plaintext[i]), key, &(outbuf[i]),
encrypt);
}
return outbuf;
}
Caveats:
Plaintext must be in a buffer that is exactly a
multiple of 8 characters long. Pad it with 0's
if the actual text isn't exactly a
multiple of 8 long.
Key must be in a buffer that is at least 8
characters long. Pad the key with 0's if it's
shorter than 8 characters. Only the first 8
characters are used.
You're responsible for freeing the returned
buffer when you're done with it.
__________________________________________________
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/