Date: Sat, 22 Feb 2003 15:33:51 -0800 From: Doug Hardie <bc979@lafn.org> To: freebsd-questions@FreeBSD.ORG Subject: encryption of data elements Message-ID: <197F7250-46BE-11D7-9DF5-000393681B06@lafn.org> In-Reply-To: <freemail.20030123002124.51347@fm11.freemail.hu>
next in thread | previous in thread | raw e-mail | index | archive | help
I need to encrypt small data elements. These elements run from about 16 to 64 bytes in size. It would be really handy if the encrypted size were the same as the original size. However, if it can't be I do need to be able to predict the encrypted size in advance. Digging around through openssl I came up with the following approach: #include <stdio.h> #include <openssl/rc4.h> RC4_KEY key; char buf[1000]; char out[2000]; int main (int argc, char *argv[]) { int size, i; size = strlen (argv[2]); RC4_set_key (&key, size, argv[2]); RC4 (&key, strlen(argv[1]), argv[1], out); printf ("%s", out); } Where the first arg is the value and the second is the key. It seems to work but I don't know if this is the best algorithm to use or if there is a better approach. Thanks, -- Doug To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?197F7250-46BE-11D7-9DF5-000393681B06>