binary problems
ok, I know this should be in encryption, but no one is ever on there, so i am posting this on here too. sorry mods if in wrong spot. I googled this and still havent found the answer unless I looked over it. I have been working on this for about 2 hours. I am working on somehting based on binary, and I got a few questions.
1.) i read on somehting that 5 in binary is 101(base 2) but I ran it through a binary prog and it came out as 00110101 and i was wondering why this is.
2.) Why is 0 as binary 00110000? is it just adding the 00110 to the original binary cause i also saw that 0 is just 000(base 2)
@vegeta_man:
you can do the conversion yourself, and not need a program… (use the following examples to get where you need to be)
Decimal-to-Binary
35 ** ** remainder 35/2=17 ––> 1 17/2=8 ––> 1 8/2=4 ––> 0 4/2=2 ––> 0 2/2=1 ––> 0 1/2=0 ––> 1
Now, write down the remainders from last to first. So, you're answer is 100011.
In your case, 5 (base 10) will be in Binary (Base 2): 5 remainder 5/2=2 1 2/2=1 0 1/2=0 1
5 (base 10) = 101 (base 2)
By the way, 0 in Binary is 0000 Keep in mind that our answer in written in bits (duh)…
- 4 bits = 1 nibble
- 8 bits = 1 byte
0 can also be 000 (notice only 3 bits), 0's are sometimes skipped and it is assumed that they are 0's. So, _000 is assumed to be the same as 0000.
Well i've done a script that you can easily use to convert number in many different base …
http://www.hellboundhackers.org/readcode.php?id=141
You'll see it's very usefull and nicely done.
thaks everyone, I got this part figured out finally. Now i gotta figure arrays(I am not 100% sure, but this is for lists right?) so I can make a simple encryption/decryption program I am doing in VB.net anyone have a common knowledge of arrays in vb.net and also, how do I figure numbers to get remainders in vb.net? This is kind of hard to google considering its too specific, but if someone gives me what "topic" I should google, i will do so, but please don't say vb.net or anything dumb as the topic.