All language subtitles for [English (auto-generated)] CS420 - 3 Base Systems - Hex, Decimal & Binary [DownSub.com]

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese Download
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

hello and welcome back to CS 420 a

course on game hacking in this lecture

we'll be covering base systems

base systems are just ways to express

numbers the numbers on this slide are

all the same number written in different

base systems binary decimal and hex now

we dabbled in binary a little bit last

lecture but now we're gonna develop a

true understanding of how binary and hex

now I know what you're thinking I came

here to learn how to hack and now you're

gonna lecture me on numbers is this some

sort of sick joke the answer is yes it

is a sick joke but don't blame me I'm

just the messenger this is a small but

necessary detour before we get back into

hacking this happens a lot when you want

to learn cool subjects if you want to

learn machine learning you need to learn

a little bit of statistics if you want

to learn physics you need to learn a

little bit of calculus we actually have

it quite easy in comparison we're just

learning how to count again before we

get started let me give you some

inspiration this is an excerpt from a

book about dead languages not

programming languages but actual spoken

languages it reads the pop and language

boogie up has two different counting

systems one base for and another base

three according to boogie up custom

which system use depends on which

objects you are counting so ancient

Papua New Guineans actually new to base

systems and have peasants living on a

remote island several thousand years ago

can learn multiple base systems then an

aspiring 21st century hacker with access

to the world's knowledge and Internet

has no excuse

let's actually take a look at this

language there's a few lessons it can

teach us that we can apply to binary and

hex so on the Left we have objects that

we count by fours things like coconuts

lizards bows and arrows and on the right

we have things that we count by threes

things like beetle nuts bananas and

shields now I want to point something

very interesting out on the Left we have

small yams and on the right we have big

yams

that means if I wanted to sell you two

groups of yams you better be careful

because if I'm talking about small yams

then there's eight of them but if I'm

talking about big yams and that means

there are six of them the important

lesson here is that numbers can mean

different things depending on the

context depending on the base system and

just a side note if you read up on this

language you'll find that I simplified

things a little bit it's quite

fascinating but really beyond the scope

of this lecture to go into more detail

you can look it up on your own if you

want

but let's take this lesson and apply it

to what we what we know our systems if

we have the number 10 we know what that

is and we can visualize it is the number

of fingers on our hands now if we take

that same number written down and look

at it in the context of hexadecimal well

it actually means 16 and binary it

actually means 2 it's similar to the

problem I mentioned before with the yams

we need to know if it's big games or

little yams we need to know if it's

binary or hex

to avoid confusion sometimes people put

a 0x before a hex number and zero B

before binary numbers people don't

always use these prefixes so it can get

a little confusing but just know that

when you see these prefixes you can no

longer trust your eyes and brain

the numbers are in those contexts now

before we go on let's take a step back

and ask ourselves why we even need to

learn this stuff it goes without saying

that humans use base 10 a common

question people have is is there

anything special about base 10 and the

answer is not really we just chose it

because it works well with a number of

fingers we have a lot of mathematicians

actually think base 10 was a mistake if

you buy Donuts in the USA they come in

twelve and there's a reason for that

twelve is easier to split with your

friends if there's two of you you both

get six if there's three of you

y'all get four that there's four of you

you all get three and if there's six of

you everyone gets two it divides up

really well and math that's known as a

highly composite number now let's take a

look at computers they store information

and either an on or off state and this

gives rise to a natural base to system

zero for off one for on that's two

options base two now this sucks for us

as humans because we never learned base

two we invented machines that do math in

a system that the majority of us don't

understand so now we need to learn it if

you've been super observant you may be

asking hey what about hex where does

that come from

hex is base 16 how does that fit into

this I hinted at this earlier with my

rant about the doughnuts different base

systems are good for different problems

base two is good because it can

represent things that are on and off

base 10 is good because that's how many

fingers we have and it's convenient for

humans base 12 is good for dividing

things up and you actually know another

base you just don't know that you know

it that's base one base one is tally

marks tally marks are good for counting

things as they happen by counting votes

in a classroom we're keeping track of

how many times different teams have won

in a competition this is useful because

he never have to erase you can just keep

adding more marks

base-16 also solves a problem but it's a

subtle problem in a bit more nuanced so

we need to learn a few more things

before we can get into it

before we try to learn binary hex we

need to unlearn decimal this is the

hardest part for people because you've

been staring at decimal numbers your

entire life let's play coast attention

to how we count numbers once we get to

ten we recycle digits the number ten

reuses the digits one and zero the

number eleven reuses one and one again

so let me ask you why not invent a new

symbol instead of just recycling

right what if we just kept going in this

example a is 10 and B is 11 and so on

well obviously we can't come up with a

new symbol for every number because

there are infinite numbers and it's just

not sustainable at some point we need to

reuse symbols and base systems tell us

how many digits we can use before we

need to start recycling

here's a system with way too many

symbols this is the Babylonian numeral

system and it's base 60 maybe this is

why the Babylonian Empire fell apart I

can just imagine it general trying to

scribble down a note asking for the king

to send a hundred horses was a triangle

triangle arrow arrow or arrow arrow

triangle triangle it's like punching in

a Konami code every time you want to ask

for simple favor but it does have one

thing going for its base 60 it's it

divides up very well similar to 12 but

it's still way too many symbols to

memorize but look what happens when we

have too few digits the Babylonians had

too many and it was overwhelming with

binary we have too few and it's even

more unreadable it turns out that

there's a range of digits that work

really well for humans probably between

7 and 20 this is my own personal

estimate a linguist would be more suited

to come up with the exact range but you

get the general idea

let's do another thought experiment what

would happen if we invented a new digit

let's add a new digit between nine and

ten using the letter A well the numbers

gets shifted now a represents 10 which

means that 10 actually represents 11 and

if that's confusing just count out the

numbers on the bottom row 0 1 2 3 4 5 6

7 8 9 10 11

the further we go the worse the shifting

gets what we thought it was ten actually

represents eleven and what we used to

think of as twenty actually represents

twenty-two we can no longer trust our

eyes here's another brain bender

what if we removed the number nine well

ten would take a spot so we used to

think of as ten would actually now

represent nine what we used to think of

as twenty would actually represent

eighteen the numbers are just shifted

again but this time in the opposite

direction let's apply this to the

systems that we need to learn these are

the numbers for each base system decimal

is obviously zero to nine for a total of

ten choices and space ten binary is zero

and one totaling two choices but hex

needs sixteen symbols and that's six

more than we used to because we're going

from ten to sixteen so we we need six

new single-digit characters so we just

steal them from the alphabet

if we count these out similar to the

previous thought experiments the

shifting it's really bad a is 10 B is 11

C is 12 and so on what we think of as 10

to us is actually 16 what we think of as

20 is actually 32

now let's take a look at the same number

represented in this in all three bae

systems so all three of these numbers

are the same

notice how ugly the number is

pre-decimal and with hex and binary

there seems to be some sort of structure

right it's a repeated letter well I want

to point something special out look what

happens when we space out the binary in

hex for every four binary numbers

there's one hex number

if we change the hex number to be FA FFF

and so on look what happens to the

binary the group that used to be 1 1 1 1

is actually now 1 0 1 0 there's a strong

correlation between the hex number and

the corresponding 4 binary numbers so

this is what I was talking about earlier

when I said that hex solves a problem

humans can't read binary very well it

doesn't convert to decimal very well

either however it is easy to convert

from binary to hex if you gave me ten

thousand digits of binary I could

convert them to hex by hand by simply

breaking them up into chunks of four and

converting those four-digit chunks into

hex if you ask someone to convert the

same 10,000 digits of binary to decimal

no human could do it without a

calculator

so now let's actually learn how to count

in binary I'll explain the same concept

in a few different ways so if one

explanation doesn't make sense to you

don't worry

first let's look at an idea that we're

familiar with in decimal if we have the

number nine nine nine nine nine and we

add one something happens

there's a cascade effect where all the

nines turn into zeros and we add a one

to the very end

well in binary it's the same idea what

would happen if we added one to this

number

well there's a cascade effect where all

the preceding ones turn into zeros and

we put a one at the end but remember

that in decimal we run out of digits at

nine and in binary we run out of digits

at one so this cascading effect happens

a lot more frequently let's take a look

at binary counting in action I'll just

let the animation play out and you can

watch and try to figure out what's going

on in your own

you

there isn't too much I can really add

here unfortunately it's one of those

things that either clicks or it doesn't

if not we'll go over a few ways to think

about this and hopefully one of those

other methods will click if this one

isn't doing it for you

so let's take a look at another idea

that we understand in decimal we know

that a hundred is ten times more

powerful than ten and we know that 1,000

is ten times more powerful than a

hundred so one way to think about this

is that a one in the hundreds place is

ten times more powerful than a one in

the tens place and so on

let's look at that same idea in binary

so that the left column here is the

binary number in the right column is a

corresponding decimal number now the top

left number here which is one we can

ignore the leading zeros that it's the

same thing as putting like a zero before

a decimal number it doesn't matter but a

lot of people do it in binary to make it

look cleaner

okay so now let's look at the next

number we know the top one is one well

the next one is two and you can think of

this as a 1 and the second position

there is worth twice as much as a 1 in

the first position right similar hap to

how in decimal a hundred is ten times

more powerful than 10 in this case we're

doing twice as powerful because we're

base 2 so we have a 1 in the first

position over here and a 1 in the second

position is twice as powerful so it goes

from 1 to 2 and now if we move that one

over to the third position here it's

twice as powerful as the previous number

so this one is actually 4

so a thought experiment what do you

think the number on the right represents

well it's actually pretty easy to do you

just add up how powerful each digit is

we establish that one zero is worth two

and that one zero zero is worth four so

you can actually just add two and four

and this number is six

let's take a look at the same idea in

chart form so the first row we have 1 1

0 1 1 and we spread out those digits

over the column so we have 1 1 0 1 1

now we established that a 1 in the first

position is only worth 1 but a 1 in the

second position is worth 2 and so on so

if you look at the top top arrows here

or top column sorry we have 1 2 4 8 16

because each place is worth twice the

previous so what we can do is if the one

is set we add what it's worth so 1 in

the first position is worth 1 so we have

1 plus we have a 1 in the second

position

that's where 2 so 1 plus 2 and this

one's not said so we don't do anything

there's a 0 here we ignore it now

there's an 8 set here so 1 plus 2 Plus 8

and there's a 1 in the 16 column so now

we have 1 plus 2 plus a plus 16 that

gives us 27 in decimal so now you know

how to piece this together just by

looking at it

now let's look at the second row this

one's a little easier there's a lot of

zeros the one bit is set so we have one

plus two isn't set it's a zero so we

skip that one and the four bit is set so

one plus four for a total of five and if

you want to do this last one I'll leave

that as an exercise to the reader but it

should work exactly the same way very

straightforward

and if we wanted to keep going we would

actually add a rose for 64 sorry 32 then

64 then 128 I hope that makes some sense

to you I'm not gonna I'm not going to go

through examples here but the idea is

that each position you multiply by two

so the more digits you have the more

powerful the leftmost digits are

this is a neat trick it's not super

useful but I thought I'd teach it

anyways you can actually count to 31 on

one hand by treating your fingers as

either 0 or 1 if you use both hands you

can actually count up to a thousand and

23 there's just a little awkward because

you can end up accidentally flipping

people off when you count to 4 but still

pretty neat just be sure not to insult

your teachers if you show them this

trick

and if it doesn't make much sense you

can just use a calculator let's actually

jump into what that would look like

so here we have the windows calculator

what we can do is go into the options

here

switch to programmer mode

and this gives us access to conversions

so if we type in a number in decimal say

255 we can click on the hex version here

and we could see that it's FF and hex we

can click on binary here to see that

it's 1 1 1 1 whatever in binary and we

could do this for any numbered type in

some giant number we could see what it

is in binary we can also do it the other

way if we know what the number is in hex

we can click on hex clear this and then

just start typing the hex number and we

can see what it is in binary so this is

wonderful I taught you everything else

for no reason because turns out that

you'll probably just end up using this

for most of everything you need to do

there's no reason to convert anything in

your head these days however it's still

very important to be able to eyeball

small binary numbers and convert small

numbers in your head but if you're

running into something like this just

use a calculator save yourself the time

if you're on Linux or Mac they also have

a programmer mode on their calculator

I'm not gonna go over how to open that

programmer mode on those but it's it

works almost exactly the same way so

there's no reason to be redundant here

the best way to solidify what you've

learned is to actually get out there and

do some hands-on activities so I'm going

to point a few out there's some video

games that I'd like you to play

so the first game I wanted to point out

is this flippy bit and the attack of the

hexadecimals from base 16 it's a little

bit of a cheesy game but it's free and

it really drives the relationship

between binary and hex so let's jump

into this

so the trick here is to match the first

four binary numbers with the first hex

digit in the last four with the last hex

digit you can see the number down here

as I type it out

so here we want to make a seven using

these first four and a four which is

going to be this bit FF is super easy

every bit gets set here we 1e

here we one a seven and at some point

you can do this without really thinking

right it's not too bad

it looks overwhelming and that's kind of

the whole point of it is it's not

overwhelming and once you get into it

you can convert the stuff in your head

next game I wanted to point out is

squally there's a minigame in squally

that drills in binary decimal and Hexter

gameplay so here we have blue cards that

are binary green cards they're hex and

white cards that are decimal and to

learn how they work through standard

game play you just made my card weaker

and that's all there is to it

and of course links to both of these

will be in the description so last time

we left off with this as our

understanding of what a computer program

was but now let's update it so before we

know that there's groups of eight bits

they can be addressed so the first group

is zero the next group is one and so on

to represent larger numbers we can use

more groups of bits so at the top here

we have this giant group of eight or

eight groups of eight bits which

represents that giant seven nine nine

five number and then there's smaller

groups right this group of one that

represents the value 101 at address 169

so let's take this idea and now we're

going to replace those with hex numbers

so hex can be used to represent binary

numbers and it's a little more human

readable so will almost never look at

binary again will probably always be

using hex except for a few exceptions in

the future what used to be groups of

eight binary digits are now represented

by two hex digits and I'll point a few

examples out to make sure that this is

clear so the group of numbers with the

value 623 is using 32-bit bits of

information or 4 bytes and the yellow

group numbers is using 16 bits of

information or 2 bytes and if it's still

confusing I recommend comparing it with

the previous screenshot anyhow I hope

you learned something about how binary

numbers and hex work and as usual if you

need anything clarified or have any

feedback drop a comment below thank you

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.