KDevelop Data Encryption Routines

_Usul John Obscurant usul at gmx.li
Mon Apr 3 00:59:54 BST 2000


-----BEGIN PGP SIGNED MESSAGE-----

Hi,

>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
the password:

- --- 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 ;)

greetings
	_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:
http://www.renegadeforce.de
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBOOj+bnWsrvvPIHCRAQEmsAP/W+L3P7XeA0zHiT2+wO0h9np/C7+s1PUj
6V0iKat85ryO5oer6orhrUDnS9Ihx8zR/MAalUZpxGgKMTmnyl8fs8hBgvr510YC
BsAeFxQ7J28TLJCY/c0BmgnN06gyvkSLzAdHty9H3/L5jKSBIsfb5LDnWlwrHsng
dX7yCoz/tHk=
=VKnL
-----END PGP SIGNATURE-----




More information about the KDevelop mailing list