SDL episode 24

From Paul's Security Weekly
Jump to: navigation, search

Secure Digital Life #24

Recorded July 18, 2017 at G-Unit Studios in Rhode Island!

Episode Audio

Coming Soon!

Hosts

  • Doug White
    Cybersecurity professor, President of Secure Technology, and Security Weekly network host.
  • Zero and One are the Lonelist Numbers

    Why do we count by 10s anyway?

    What is Binary and why do we use it? Programming Networking! Hex!


    How do you count in binary

    0 1 10 == 2 11 == 3

    How can I convert decimal numbers to binary?

    You MUST memorize the powers of two up to 2^7 Power 0 1 1 2 2 4 3 8 4 16 5 32 6 64 7 128

    If you know these powers, you can convert any number in 8 bit binary to decimal and vice versa.

    Binary numbers are written from left to right (big Endian) typically just like regular numbers (decimal) and they are usually written with a space every four bits (four bits is called a nibble).

    1010 1100

    You CAN do this in your head, practice. Each power lines up with a bit 7654 3210

    So, each place represents a power of two.

    If a bit is turned on (1) then you add that power of two to the total. If the bit is off (0) then it's just 0.

    So if we convert the number above we get

    128 + 0 + 32 + 0 + 8 + 4 + 0 + 0 == 172

    That's it. If you practice a little bit, you will see the same patterns of addition over and over and over and can pretty quickly in your head convert binary to decimal.

    Converting the other direction is not so easy, but it's really just the same thing.

    There are many methods on the internet for converting decimal to binary and you should learn one that works. Mine is just doing simple sums in your head:

    First, is the number <= 255? If it is, then it's 8 bits (byte). Second, is the number <= 15? If it is, then it's 4 bits (nibble).

    51 What is the biggest power of two that will "fit" in the number? Well, 128 won't fit so turn that bit off 64 won't fit so turn that bit off 32 will fit so now we have a bit 0010 0000 == 32 subtract that from the number (51 - 32 == 19) Repeat 16 will fit so turn that bit on too 0011 0000 == 48 subtract again (19 - 16 == 3) now 8 won't fit 0011 0000 even 4 won't fit 0011 0000 but two will 0011 0010 == 50 (usually at some point you can just intuit it) subtract (3 - 2 == 1) so turn on that last bit 0011 0011 check your work 0 + 0 + 32 + 16 + 0 + 0 + 2 + 1 == 51

    That's all there is to it.

    In networking, you don't usually need more than 8 bits. In