Encryption using C/C++

Status
Not open for further replies.

Obitus

Ars Scholae Palatinae
1,222
I want to make my own encryption program, more as a learning and practice exercise then anything else.

I was wondering if anyone could provide me with links that would have information relating to encryption as I have only a very rudimentary knowledge of it. I kind of need example algorithms to go by.

I'm not really worried about it being very secure at the moment. First I just want to learn the basics and work my way up to maybe creating one that might be relatively secure later.
 
Google is your friend. A search on "RSA algorithm" gave this short explanation: http://world.std.com/~franl/crypto/rsa-guts.html

Of course, implementation details aren't there, and you'll probably want to start with small primes (a few digits) if you only want to learn. You'll need to have some math knowledge to work out RSA, even if it's fairly simple.

You could also look into symmetric encryption.
 

Citrus538

Ars Legatus Legionis
12,722
The simplest form of encryption I have though of is having the user enter a password, and then doing the following:

code:<HR>
Code:
Initialize data
Set i to 1st character in password
while not at end of data
  add ASCII value of current letter (i) to one byte of data
  mod the byte by 256
  write the result<P>  if i is the last letter of the password
    set it to the 1st character in the password.  
  Otherwise
    just set it to the next character in the password.
  try to read the next byte of data

To decrypt it, just enter the same password and do the opposite.
 

Citrus538

Ars Legatus Legionis
12,722
Yes I am aware of the Midlands. When I originally created the program, I wrote up an small readme that stated what situations it should be used for and what weaknesses it has (if the file type is known you may retrieve part of the password due to knowing the file header).

It's simple though, and good enough for private use. Just don't forget the password : )

I'm thinking about making a computer diary/journal that uses this algorithm but want to make a GUI for it and I don't know enough about Windows programming yet.

[This message was edited by Citrus538 on February 16, 2002 at 12:20.]
 

bash666

Ars Legatus Legionis
24,417
Originally posted by Citrus538:
Yes I am aware of the Midlands. When I originally created the program, I wrote up an small readme that stated what situations it should be used for and what weaknesses it has (if the file type is known you may retrieve part of the password due to knowing the file header).

It's simple though, and good enough for private use. Just don't forget the password : )
If by personal use you mean to stop someone with out any cryptography training, such as a child or a spouse, when why not just xor the data with the key(password)? It will just look like garbage and make no sense. This is by far the simplest and weakest crypto available.

-Kevin
 

Aeirould

Ars Tribunus Angusticlavius
7,535
Subscriptor
the point of the thing is Obitus wants to learn something, and you two ain't helpin'

On the contrary - By his question and my answer, it should become obvious to anyone who's even done the Games QuiptoCrip what's going on there. XXXX XXXXX XXX13?

First word is 99% likely a question word.

What and When are the only two that fit the length

Wh are then translated to J and U respectively

Try What - see that the T letter (g) is repeated in three places, so try:

Wh_t ____t __T13

Notice that the A letter is also repeated:

What a___t __T13?

Notice that my response specified ROT13

What a_o_t ROT13

Get the word about from context.

Solved. All the necessary information was there... and one learns better by figuring from given clues than from reading an explanation (or at least *this* one does).

Whether or not he noticed the 13 character rotation would have been the question, but given the ROT13 given name of the cypher it shouldn't've been a leap.
 
Status
Not open for further replies.