Hexes and the Magic of 16 🔮
there are a lot of
ways to do something
different
you can write numbers in lots of different ways
(it really just depends on how many digits you want to use)
10 digits:
base 10
2 digits:
base 2
/ denary
/ binary
16 digits:
base 16
/ hexadecimal
➡️ 205
➡️ 11001101
➡️ . . . ?
base
are possible per place value
digits
refers to how many
base 2 | base 10 | base 16 |
|
|
A, B, C,
D, E, F
0, 1
0, 1, 2, 3, 4,
5, 6, 7, 8, 9
0, 1, 2, 3, 4,
5, 6, 7, 8, 9
10 digits:
base 10
2 digits:
base 2
/ denary
/ binary
16 digits:
base 16
/ hexadecimal
➡️ 205
➡️ 11001101
➡️ CD
yes, really
➡️ 3 digits in base 10
205
➡️ 8 digits in base 2
➡️ 2 digits in base 16
11001101
205
CD
🆗
but...why does that matter?
🆒
11001101
1
1 bit
1 byte
11001101
8 digits === 1 byte
the fewer the digits,
the more information,
in a tiny amount of space.
💡
2 digits === 1 byte
8 digits === 1 byte
#EC152E
rgb(236, 21, 46)
===
#EC152E
rgb(236, 21, 46)
2E
15
EC
46
21
236
236
3 bytes
21
46
r
g
b
rgb(236, 21, 46)
236
21
46
r
g
b
RGB color model
additive color
theory of trichromatic color vision
#FFFFFF
#000000
#EC152E
2E
15
EC
1 byte
1 byte
1 byte
256 permutations
256
256
256
x
x
=
16,777, 216
any number from 0-255
16 x 16
=
256
hexes are everywhere!
1/ ascii encoding
2/ hexspeak
3/ IPv6 ip addresses
#EC152E
111011000001010100101110
🔑
abstractions
they're not magic!
abstractions are just that :
💫
understanding abstractions is what them magical
makes
medium.com/basecs✨
@vaidehijoshi
the magic of 16
By Vaidehi Joshi
the magic of 16
- 1,794