# Basic Encryption?

## Recommended Posts

I was wondering if someone could explain a little bit how to do basic encryption. I checked throught the article's here at GameDev but only found one article, and it was in VB so I really didn't understand it. I am programming in C++.

##### Share on other sites
TEA is easy to implement and from what Ive read its very secure. You can also make it very fast by unwinding the loop. Just click that link and you should find a lot of info on it (including C++ implementations).

##### Share on other sites
Encryption Lessons

##### Share on other sites
Err sorry that didn't work. Encryption Lessons

##### Share on other sites
Quote:
 Original post by mike25025TEA is easy to implement and from what Ive read its very secure. You can also make it very fast by unwinding the loop. Just click that link and you should find a lot of info on it (including C++ implementations).

This thread has a few implementations as well to take a look into for TEA.

##### Share on other sites
http://www.und.edu/org/crypto/crypto/lanaki.crypt.class/lessons/

##### Share on other sites
I am sorry but I don't seem to understand any of that. What I meant by my first post was how would I effectively code my own form of encryption. I get the concepts but not how to code it.

##### Share on other sites
Sorry, but rule number one about effectively implementing encryption in software is not to roll your own. Seriously consider using a pre existing encryption library.

##### Share on other sites
Quote:
 Original post by kelchargeI am sorry but I don't seem to understand any of that. What I meant by my first post was how would I effectively code my own form of encryption. I get the concepts but not how to code it.

Basic example of encryption:
char someInputString[] = "Hello world!";int key = 35;for(int i=0; i<strlen(someInputString); i++){ cout << char((int)someInputString[i]^key);}cout << endl;

Quote:
 Original post by SiCraneSorry, but rule number one about effectively implementing encryption in software is not to roll your own. Seriously consider using a pre existing encryption library.

Agreed, especially if you having problems such as figuring out the basic concepts of implementing it.

##### Share on other sites
Quote:
Original post by DevLiquidKnight
Quote:
 Original post by kelchargeI am sorry but I don't seem to understand any of that. What I meant by my first post was how would I effectively code my own form of encryption. I get the concepts but not how to code it.

Basic example of encryption:
*** Source Snippet Removed ***

That method is not good. It can be broken in a couple of minutes. For basic XOR encryption you need a large key an possibly a changing key.

##### Share on other sites
Quote:
 Original post by mike25025That method is not good. It can be broken in a couple of minutes. For basic XOR encryption you need a large key an possibly a changing key.

Thats why I said basic example of encryption, if I was going to post something like RSA it would be a bit large.

##### Share on other sites
I was simply pointing out that it was not secure so that the OP or another reader would not use it thinking it was secure. Sorry if I offended you.

##### Share on other sites
Quote:
 Original post by mike25025I was simply pointing out that it was not secure so that the OP or another reader would not use it thinking it was secure. Sorry if I offended you.

Not offended, I was just pointing out that if is having trouble seeing how encryption worked a simple concept would do best in showing how it works.

All simple concepts can be broken quite quickly, no single encryption method is enough now of days, I think its best to combine a few.

##### Share on other sites
DevLiquidKnight: Thank you for showing me a simple code snippet for making encryption. :)

##### Share on other sites
If you're really serious about that, I suggest you take a look at "The Code Book" by Simon Singh. It's kind of a historical look at cryptography. It's low-level math, which might be good for someone unfamiliar with some of the number theory involved in higher level crptography (i.e. RSA).
If you actually need it to be secure, there are some US standards for secure cryptography. If it's for a game, and it's not really meant to withstand a serious attack or set of attacks, you could probably implement your own (more secure) version of the enigma machine with the ideas from the book.

Again, just to be clear:

Serious security - check some US standards, do NOT design your own algorithm

Game 'security' (not necessarily that secure) - feel free to design your own, check the book for some ideas.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• ### Forum Statistics

• Total Topics
628284
• Total Posts
2981831

• 10
• 10
• 10
• 11
• 17