You are not logged in.
#1 28 Oct 2006 3:37 pm
- Butcher
- Moderator
- From: Norway
- Registered: Jul 2006
- Posts: 308
Bit-coding in a simple explanation
Can someone explain to me, in the simplest way humanly possible, how a bit-encryption works? No, I have no intension of learning how to hack anything, I simply wish to learn something new. I imagine that the difference between a 128 bit encryption and 256 bit encryption is that the 256 bit one has twice as many combinations to be solved compared to the 128 bit one. I will in this odd post try to explore the possibilities of bit-encryptions, and how they work.
As bits are merely constant factors, used in most games and config files (my 60 year old math teacher actually learned me something I remembered, :lol:) as a variable between 0 and 1. Example from BF2 server config: "sv.punkBuster 1", which enables the Punkbuster anti-cheat program to work on the selected server.
Then doing a quick wikipedia search, I remember what I learnt last year, from my 55 year old math teacher (have I ever had a young math teacher that doesnt have bad breath and steals my pens? No), all bit codes have either 1 or 0 as their "answer", it only has 2 possible options, so the a 128 bit-encryption would be represented by 2 times the number of bits present, so for example a 128 bit-encryption would be 2 times 2 128 times, like:
Code:
2^128=3.40282367 × 10^38
So the 128 bit-encryption has over a "trillion" combinations of keys and numbers that can be the password or "answer". Say Hotmail used the 128 bit-encryption, and you wanted to try to guess the password for an account there. It would then have over a trillion possible combinations of numbers or letters.
I would now also guess that a hacker, or programmer, has made a program that tries all the possible combinations of such possibilities for hacking purposes. A program that instinctively tries every combination would take a good computer to run, and a even more brilliant person to develop.
But what really interests me, is how bit-encryptions are made, can someone answer that?
And by the way, the ^ signifies that the numbers behind it should be in superscript, tough I could not get the BB code for superscript to work here.
Offline
#2 28 Oct 2006 5:41 pm
Re: Bit-coding in a simple explanation
think of a bit like a light switch. computers are like a bunch of light switches where they can be either on or off. likewise a bit is represented by a 0 or a 1 (binary). when you see notation like 2^128 (2 to the power of 128) is because you have 2 possible values for a bit, and if you have 128 bits then you have the result of that operation as possible values.
a byte is made up of 8 bits and is typically the smallest unit of storage we deal with. since 2^8 = 250, the smallest value a byte can hold is 0 and its largest value is 255.
some languages have the notion of a variable type that contains either 0 or 1 and is referred to as a boolean value (true or false), and in some languages 0 and 1 are implicitly tied to a boolean type. so code like: sv.punkBuster 1 would be the same as saying sv.punkBuster TRUE (though I doubt that the script files would be able to intrepret the "TRUE" string).
developing a brute force cracker like that doesnt take a rocket sicentist, it takes a clock, and lots of computing power. your typical gaming computer isnt optimized for that kind of work. nasa and the US govt have super computers that are able to process that kind of work a lot quicker than any of our systems would be able to do.
there are lots of ways to derive a key from a set of cipher text (depending on the encryption method, some are easier than others). If this type of thing interests you there are tons of books on cryptography that will definitely be worth your time. as long as there has been "encryption" there have been those who try to "decrypt" it. This topic predates computers and will far outlive them. in WWII the united states used Navaho's (native Americans) to communicate between fronts (because no other group of people has the same language, nor did the Navaho's have words for the common things of war) and their cipher texts were never broken during war time.
encryption is made by folks who have a grasp on math that far exceeds mine. check out http://rsasecurity.com or wiki / google Ron Rivest (he's the guy who came up w/ most of the algorithms that are commonly used today) if you want to learn more on the wacko's who understand the mechanics behind the algorithms used in strong encryption.
Offline
#3 29 Oct 2006 2:32 am
- Butcher
- Moderator
- From: Norway
- Registered: Jul 2006
- Posts: 308
Re: Bit-coding in a simple explanation
Hmmm, play.com has so many books. How can I tell which ones will teach me about how it is built and which analyzes it?
Offline
#4 30 Oct 2006 8:53 am
Re: Bit-coding in a simple explanation
I dont know of any books. I've acutally stopped buying / reading books for learning stuff (just too much info online to do that these days).
wikipedia.org is probably your best resource. I'm not really big on cryptography (or math), though I've been labeled the crypto guy at work. Encryption is a topic that transcends computing, and there are volumes of information written on that that has nothing whatsoever to do with computer encryption. which book is best, I have no clue. most of the common encryption algorithms used on computers can be found on wikipedia.org and they have lots of info on how they work.
if you wanted to buy a book, I'm sure any generic crypto book is going to help you understand the basics.
ps i added the superscript stuff to the bbcode this weekend (along w/ some other stuff).
Offline
#5 30 Oct 2006 1:21 pm
- Butcher
- Moderator
- From: Norway
- Registered: Jul 2006
- Posts: 308
Re: Bit-coding in a simple explanation
Cool , they should make those bb codes a normal thing in all PHPBB forums, hehe. I found a few books that seem good (I prefer reading it in a book instead of on a computer screen, it's so damn light, ).
Offline
#6 30 Oct 2006 1:39 pm
Re: Bit-coding in a simple explanation
phpbb does include a lot of bbcode in their software, but these forums aren't phpbb, so all the extra's I have to add myself (though punbb is MUCH easier to modify than phpbb).
Offline
#7 03 Nov 2006 8:37 am
- Dok
- New Member
- Registered: Nov 2006
- Posts: 3
Re: Bit-coding in a simple explanation
encryption is pretty interesting stuff once you really get into it. Regretfully, I've never had the time to learn mch more than the basics.
Anyway, basically, its all about manipulating the bits that make up characters.
Base64 is about the similest example of bit manipulation.
for base 64, you convert each character in a string to its ascii value, then that to its binary value.
So, if you have "abc" that turns to:
a=97=01 10 00 01
b=98=01 10 00 10
c=99=01 10 00 11
Then we take all those binary digits and combine them into a single string "01 10 00 01 01 10 00 10 01 10 00 11"
From this point, we take every 6 bits and convert that into a number. (6 bits 111111 = 63, thus the name base64)
011000 = 24
010110 = 22
001001 = 9
100011 = 35
From those numbers, we take the index of the key (0=A, 1=B, etc) ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
24 = Y
22 = W
9 = J
35 = j
base64 is about the simplest form of encryption, but if you wanted to make up your own, you could always just modify the key and it would be pretty difficult to crack for most people.
Now the more advanced types of encryption gets into XOR'ing values, which basically takes those bits and compares it against the key, returning a 1 or 0 depending if they're equal or different (both equal returns 0, both different returns 1).
If we had 0100 and XOR'd that against 1010, we'd come up with 1110
( 0 ^ 1 = 1, 1 ^ 0 = 1, 1 ^ 0 = 1, 0 ^ 0 = 0), which if we did that against the complete string above, possibly with multiple keys, we'd have a decent encryption.
That 4 bit example is only half of a single character, so I'm sure you can see how even a single character (8 bits) xor'd against another character could come up with 2^8(256) results if you tried to bruteforce the key. Now take a 128 bit key (make sure to pad the string to at least 128 bits as well) and you end up with a huge number of possibilities. Unless you actually know what the output is supposed to be (like text, a zip file, etc), it makes it near impossible to break it with out the key. Of course if you know the results are standard ascii text, you can quickly narrow down the possibles.
Thats about as far as I've ever gotten into encrypting stuff myself. I suppose you could do some really fancy stuff with adding/multiplication, bit swapping, etc, but these are the bare basics.
Of course most everything does things on a hex level, but I used binary/decimal for ease of understanding.
Last edited by Dok (03 Nov 2006 8:54 am)
Offline
#8 03 Nov 2006 9:05 am
- Butcher
- Moderator
- From: Norway
- Registered: Jul 2006
- Posts: 308
Re: Bit-coding in a simple explanation
Cool, now I wanna learn it even more , for some weird reason, I take nearly no interest in mathematics in school other than trying to understand it to keep my grades up. But binaries, bit-coding and forms of encryption interest me a lot.
Offline
#9 07 Nov 2006 8:20 am
Re: Bit-coding in a simple explanation
Thats because math, for the sake of math, is pointless. I was the same way in college. I could not understand why I needed to spend 45 minutes on one integration problem that had absolutly no relavence in the real world.Butcher :
Cool, now I wanna learn it even more , for some weird reason, I take nearly no interest in mathematics in school other than trying to understand it to keep my grades up. But binaries, bit-coding and forms of encryption interest me a lot.
Offline
#10 07 Nov 2006 8:53 am
Re: Bit-coding in a simple explanation
I was the same way w/ linear algebra. It didn't help that the professor spoke in variables: "let sigma equal a 12 x 12 matrix (draws it on the board), let alpha equal the inverse matricies x epsilon, let epsilon equal a 12 x 2 matrix (draws it on the board)" then proceeded to say things like "sigma, epsilon, sigma, sigma, alpha... alpha, sigma, sigma, epsilon..."
I stopped going to class and just read the book and found out that it wasn't as complicated or abstract as the professor was trying to make it out to be (and actually had application to things in real life like image manipulation).
Offline
#11 07 Nov 2006 10:10 am
- Butcher
- Moderator
- From: Norway
- Registered: Jul 2006
- Posts: 308
Re: Bit-coding in a simple explanation
Thats the dumb thing about my maths book, it has absolutely no regard for unexperienced people, and shows no good rules supported by examples to explain how things are done.
Offline