+ 3
Why 256 ASCII combinations?
I keep hearing about the number 256 thrown about in reference to bytes, ASCII, and/or hexadecimal. What does it mean? Aren't there way more than 256 8-bit combinations?
6 odpowiedzi
+ 14
One bit has two possible values 0 or 1, (2^1=2)
Two bits has 2^2= 4
Three 2^3= 8
... 2^4= 16
... 2^5= 32
... 2^6= 64
... 2^7= 128
And Eight bits has 2^8= 256
Notice how the values double for every bit?
You are probably confusing total number of values possible in 8 bits with 32, 64 or even 128 bits.
2^8= 256 # 8 bits
2^16 = 65536 # 16 bits
2^32 = 4.29497*10^9 # 32 bits
2^64 = 1.84467*10^19 # 64 bits
+ 8
The possible values of 8-bit, or a single byte, would be
0000 0000
0000 0001
0000 0010
...
1111 1110
1111 1111
This ranges from 0000 0000 (0) to 1111 1111 (255), which is a total of 256 distinct values.
+ 6
Just adding little more to what Hatsy said....
The number of values that a number system can represent is is equal to its base..
Binary has base of 2 so it uses only 0 and 1 bits to represent any number.
The number of values we can represent using bits is equal to 2^n where n is number of bits in representation .
Ex.
using 2 bits we can represent 2^2 =4 values
00
01
10
11
Using 3 bits 2^3=8
000
001
010
011
100
101
110
111
ASCII is 8 bit code system it has 2^8=256 characters.
These are enough to represent all alphabets, numbers and special symbols and some functions also.
+ 5
2^8=256
+ 4
Also, ASCII has 128 possible values, not 256.
There are a lot more than 256 possible letters in all of the word which is why we use unicode (up to 32 bits per letter) instead of ASCII (7 bits per letter) most of the time!
+ 2
Thanks everyone!