Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Encryption – The Basics

encryption

  • Please log in to reply
20 replies to this topic

#1 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 03 December 2007 - 09:01 AM

Encryption – The Basics


What is encryption?
Short answer – Making something unreadable without first decrypting it.
Long answer – Let’s take an example string, ‘Text’ now as it is it is perfectly readable by any program, even your naked eye, now with encrypting it I could apply an algorithm to that string and transform it to virtually anything, for example, ’1548795200 7’ yeah, of course this was just a random number, but with some algorithm you could transform that string to anything. All you need is an algorithm. Might sound simple, yeah let’s just invent a formula, well fellas, when highly sensitive data is in place, and maximal security is needed then it is not so simple. We can virtually encrypt anything, a string, a file, a telephone line, sound, movies, text, internet connection and whatever we need to secure virtually.

When is this used?
This is used when we need security, we need to secure our sensitive documents, our financial information etc. We don’t need to encrypt our mp3 files, I bet you would not want to encrypt and decrypt an mp3 every time you want to listen to some music on your computer.

Why do we use it?
Well, nowadays privacy is a very important thing that every human needs, and we all want to feel safe about our data. We all know about crackers (usually mistaken as hackers) and we don’t want our document to be spread online freely for everyone to see. So that is one of the many reasons, another one would be to secure a software, even a shareware program, so as not to crack it simply by modifying some addresses in the program, if everything is encrypted it will be harder, as before we need to decrypt that, or find a security hole in the algorithm and exploit it, but still that is harder.

How can we do it?
We can achieve this by applying an algorithm to the file/string, in this manner we are actually destroying the original data and storing it as encrypted and the only way to retrieve the data back is not by going into the recycle bin and restoring it lol, but generally by applying the reversal of the encryption algorithm and get our data.

Now what’s next?
Now I made a software, which you can download at the end of this article, which you can experiment with. It contains 3 samples of the simplest string encryption algorithms I could find. These are called:
  • Flipper
  • Shifter
  • Reverser

Now let’s start with the Flipper:
This one is very, very, very, simple. This divides the string into pairs, for example takes this string, ‘Text Here’ and it divides it into pairs of two like this ‘Te’, ‘xt’, ‘ H’, ‘er’, ‘e’ (note that near the H there is a space, that is counted as a character. And it flips each character with the other, it takes the first character and replaces it with the second and replaces the second with the first, so it is something like that ‘eT’, ‘tx’, ‘H ‘, ‘re’, ’e’ so the result will be like this:
‘eTtxH ree’

Now let’s continue with the Shifter:
This one perhaps is not so easily detected, but still is not secure enough, this takes a string, again let’s take ‘Text Here’ and it takes the ASCII of each and every character and it makes the ASCII plus one, for example if the ASCII is 60 this one will return it as 61. Basically the next letter in the alphabet (at least in the English alphabet, but let’s not forget of characters like space and such) so that string would be something like ‘Ufyu!Ifsf’

And last one the Reverser:
This one is basically very simple, it just reverses the string for example ‘Text Here’ would become ‘ereH txeT’

What’s the fun?
You can experiment with that software I made you can even apply more than one encryption on the same string. For example you can use the Reverse, the Shifter and then Flipper, and Shifter again and Reverser and so one. In that way the only method to get your original string back would be to click the buttons again in the reverse order! Or you will never get your original string back! Yeah that’s right, so those algorithms applied several times on the same string would make it a pretty secure encryption.

Attached Files


  • 0

#2 John

John

    CC Mentor

  • Moderator
  • 4450 posts
  • Location:New York, NY

Posted 09 December 2007 - 08:04 PM

Whats the difference between encoding and encrypting?
  • 0

#3 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 10 December 2007 - 06:17 AM

Well I am not 100% sure on this one but with 'encode' you can encode a video with a specific codec (like DivX) or transform analog signal into digital form encding can even be used in compression etc... while encrypting is more related to encrypting data.
I think....
  • 0

#4 Lop

Lop

    Speaks fluent binary

  • Just Joined
  • PipPipPipPipPipPipPip
  • 1112 posts

Posted 11 December 2007 - 08:46 AM

Encoding is the process of transforming information from one format into another

Encryption is the conversion of data into a form, called a ciphertext, that cannot be easily understood by unauthorized people
  • 0

#5 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 11 December 2007 - 10:39 AM

I think that I was close :)
  • 0

#6 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 13 December 2007 - 08:55 AM

One thing to be aware of is that all three methods described, while valid examples of encryption, are almost completely useless for protecting data by today's standards. Most of the strong versions of encryption employ algorithms developed by mathematicians to make uncovering the original message extremely difficult.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#7 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 14 December 2007 - 04:19 AM

Yeah - As I think that I said in the article its self, these are not recommended for use where sensitive data needs to be secured. There are only the very basics!
  • 0

#8 Chinmoy

Chinmoy

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 365 posts

Posted 03 March 2008 - 03:58 AM

thats good enough for starting.you can move on to higher ones like rc-64 maybe...but thats where you start.definitely.
  • 0

#9 Guest_Kaabi_*

Guest_Kaabi_*
  • Guest

Posted 26 May 2008 - 06:09 AM

I like learning about encryption, it is pretty interesting. Use an algorithm to encrypt strings and then use a special key to decrypt it. As you said, starts off simple and gets extremely complicated as you increase security.
  • 0

#10 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 26 May 2008 - 08:16 AM

I totally agree. Besides that it's a very interesting subject, and has an important role in the IT sector.
  • 0

#11 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 26 May 2008 - 09:22 AM

Maybe you could do a tutorial to try and decrypt the text - without knowing the algorithm! You could run a test which does all the common algorithms, in search of the original text. :)
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#12 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 06 June 2008 - 10:11 AM

I don't think so. Thats quite hard to do and explain.
  • 0





Also tagged with one or more of these keywords: encryption

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download