KDevelop Data Encryption Routines
_Usul John Obscurant
usul at gmx.li
Sun Apr 2 23:59:54 UTC 2000
-----BEGIN PGP SIGNED MESSAGE-----
>I am only 17, and recently trying to
>program C/C++, but have been using
>Linux for about 1.5 years.
oh, me too ... though i started programming some 4 years ago ...
>Does anyone of you, maybe know some tips
>on how to encrypt textfiles with an easy
>algorithm in the C/C++ programming language?
well, the question is, what type of encryption you'd like to use - an easy and
fast algorithm, but quite easy to crack (but ok if you only don't like that any
person may read your texts), or something you can use to send high security
information but will use some time for larger files ...
for the last, use pgp (pretty good privacy, included in some
linux-distributions), it is supposed to be even uncrackable for secret services
eg. the nsa - just great, i'm using it for most of my emails ...
if you want to write the program by yourself, you should look at a
documentation of the compression used eg. in gif-files (i think it's called
lzw), for text files you'll get quite good compression rates as 80%
to encrypt, the easiest thing would be to xor each caracter with a caracter of
- --- snip ---
char * password;
char * text;
int i, j;
// get password and text here
for(i=0, j=0; i < strlen(text); i++, j++)
if(j >= strlen(password)) j = 0;
text[i] = text[i] | password[i];
- --- snip ---
to decrypt, you just run the program again with the same password
if you like, you can do the same first with a random value generated by the
program, store that at end of the file and the encrypt with the given password
(and to decrypt you use the given password first and then the password at the
end of the file ...)
btw - a friend of mine (his name's michael zell, email zhost at gmx.de) has
written a program like this, he's also member of this mailing-list ... you
might ask him for the sources ...
(michael, hope you don't mind giving your address to other people ;)
_usul john obscurant
_Usul John Obscurant of RenegadeForce PHC
eMail: usul at gmx.li (private)
or: renegadeforce at gmx.de (official)
homepage will be up about july at:
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
More information about the KDevelop