Detect Corruption with a Checksum

  Рет қаралды 15,307

Jacob Sorber

Jacob Sorber

2 жыл бұрын

Patreon ➤ / jacobsorber
Courses ➤ jacobsorber.thinkific.com
Website ➤ www.jacobsorber.com
---
***
Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.
About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.
More about me and what I do:
www.jacobsorber.com
people.cs.clemson.edu/~jsorber/
persist.cs.clemson.edu/
To Support the Channel:
+ like, subscribe, spread the word
+ contribute via Patreon --- [ / jacobsorber ]
Source code is also available to Patreon supporters. --- [jsorber-youtube-source.heroku...]

Пікірлер: 43
@f15sim
@f15sim 2 жыл бұрын
You might want to cover CRC as well. CRC & checksums are heavily used in serial transfer protocols like XMODEM and ZMODEM.
@LuxFlascH
@LuxFlascH 2 жыл бұрын
YModem is awesome for serial transfer between Microcontrollers and/or Raspberrys like you said!! But I would always prefer YModem over Xmodem due to the 1k chunk option and the much higher security (CRC16 instead of CRC8). It's awesome to transfer fwu and files
@f15sim
@f15sim 2 жыл бұрын
@@LuxFlascH There was an XMODEM-1K, but it didn't take off.
@Hauketal
@Hauketal 2 жыл бұрын
The function printing a buffer should be protected against control characters. Otherwise the state of your terminal may be corrupted too.
@69k_gold
@69k_gold Жыл бұрын
Correct. Also he should've printed the string in hex tbh. It just makes more sense in terms of computer networks
@anon_y_mousse
@anon_y_mousse 2 жыл бұрын
I would like to see you do a video on CRC's. Explain how they came up with the table they use mathematically. I think you could make it more approachable for newbies and would definitely make for another video to recommend.
@rustycherkas8229
@rustycherkas8229 2 жыл бұрын
"You just begin. You do the math. You solve one problem and you solve the next one and then the next. And if you solve enough problems, you get to come home.” ---Mark Watney... Like he was talking to all who attempt to write software...😁
@DenisovichDev
@DenisovichDev 2 жыл бұрын
Good video as always Jacob
@gabrielruszala4432
@gabrielruszala4432 Жыл бұрын
Amazing video. Thank youuuu
@starc0w
@starc0w 2 жыл бұрын
Great stuff! Thx!
@sumitbhosale3401
@sumitbhosale3401 2 жыл бұрын
Cool Video. Thanks.
@cleightthejw2202
@cleightthejw2202 2 жыл бұрын
@Jacob Hey, is there any reasonable thing you could do to help the volume of your audio? I'm only asking because the audio isn't horrible but it could be 'louder' (my speakers are already maxed). And there are other channels I watch where those guys are much louder on my side but I definitely didnt' change anything. Thank you :)
@SlideRSB
@SlideRSB 2 жыл бұрын
I loved The Martian. One of my favorite sci-fi novels.
@dwaynestgeorge2558
@dwaynestgeorge2558 Жыл бұрын
Thanks
@forben3523
@forben3523 2 жыл бұрын
Can you do a video about "auto&&" and forwarding?
@jacko314
@jacko314 2 жыл бұрын
i think a good follow up would be combining error correction algorithms, which really are only applicable to 4 bit, 16 bit, 64 bit based blocks of data (because ecc uses 2d mapped bit arrays). but often this is used in conjunction with an acceptable error detection algorithm like crc64 and in hardware... but of course can be done in software as well. most computers today contain such hardware, like networking cards, motherboards, memory... ect. the idea is pretty simple mathematically, but demonstrates why sometimes hardware is really superior to software for certain applications... enter fpg and custom chips. i helped integrated a dedup driver for a popular file system and checksums was vital for detecting corrupted/duplicated data. i think another follow up would be how checksums can fail for detecting duplicated data if you apply encryption/compression. also checksums are the basis for maps/hashes as well if implemented correctly... actually hashing/compression/encryptioin/dup detection and more all share a lot of commonality related to checksums as they all effectively randomize a bit stream. compression and encryption probably being the most fascinating.
@jacko314
@jacko314 2 жыл бұрын
also on a more theoritical level it would be interesting to talk about why a series of checksums for different messages should not be compressible. it is one of the way new checksum algorithms are tested, especially if they are to be considered by a standards body.
@Mnogojazyk
@Mnogojazyk 2 жыл бұрын
Dr. Sorber, I appreciate what you’ve shown us, but I’m unclear about how a checksum is used in message transmission, file storage, etc. Would you consider a demonstration of that, please? Showing both ends of the process would be helpful, i.e., preparing the transmission and parsing the transmission upon receipt. Is the checksum appended or prefixed to the message and the entire packet sent? Or is the checksum sent in a separate transmission to mitigate against corruption, for instance? Many thanks for your kind consideration.
@anon_y_mousse
@anon_y_mousse 2 жыл бұрын
You could check out Ben Eater's channel, he's got several videos on things like hamming codes and distances, parity errors and even CRC's. Even shows how to implement some of this at a hardware level.
@Mnogojazyk
@Mnogojazyk 2 жыл бұрын
@@anon_y_mousse, thanks! I’ll do that!
@Ryan-xq3kl
@Ryan-xq3kl Жыл бұрын
checksums are used for verification and lookup tables, you cannot derive the data from the checksum without bruteforce which is unreasonable so in a sense there is one layer towards encryption as well although clearly the encryption could be broken via a lookup table.
@Or.BenHaim
@Or.BenHaim Жыл бұрын
Isn't the case change when it bit 6? when you add the to byte 32 or subtract 32
@Scotty-vs4lf
@Scotty-vs4lf Жыл бұрын
76543210 - Bits 01000001 - A 01100001 - a yep bit 6 i thought so too, but bit 6 is adding or subtracting 64 not 32
@Marco-yj6gg
@Marco-yj6gg 2 жыл бұрын
Too bad it doesn't work on politicians 😁
@ramakrishna4092
@ramakrishna4092 2 жыл бұрын
Hi Jacob I have been following you from month Today I come across one questions in my interview He asked me why pointers are not used in embedded C I don't have points to say or to explain Can you pls explain why pointers are useful and their disadvantages in Embedded C...
@monochromeart7311
@monochromeart7311 2 жыл бұрын
Pointers ARE used in embedded C, it's dynamic memory (free-store) that isn't used in embedded C. The reason dynamic memory isn't used in embedded C, is because the hardware is very limited in memory and performance. Memory allocations can cause fragmentation (a form of memory leaks) and are very slow to do due to their dynamic nature. At most, dynamic memory should only be allocated *once* at the *start* of the program.
@herrdingenz6295
@herrdingenz6295 2 жыл бұрын
nice explanation .. but you should do a follow-up vid about CRC/MD5 etc and how to implement those for security measures.. and since you were taling about sending data around.... why don't you write a networking lib (just some basic client/server communication thing) from scratch? first in C .. you may use libcurl^^ and then the whole thing asynchronously in C++ just to show us how to do it ;)
@JacobSorber
@JacobSorber 2 жыл бұрын
Sounds like a good plan. I'll see what I can do. Thanks.
@tk36_real
@tk36_real 2 жыл бұрын
Aren't overflows undefined behavior?
@Reiqy
@Reiqy 2 жыл бұрын
Unsigned overflows are well-defined in C.
@filips7158
@filips7158 2 жыл бұрын
Not in C. Truncation occurs silently, you're either aware or it or you're not. Hence the compiler warnings when it detects potential overflow condition at compile time.
@Marco-yj6gg
@Marco-yj6gg 2 жыл бұрын
Signed integer overflow is undefined, unsigned integer overflow is defined.
@anon_y_mousse
@anon_y_mousse 2 жыл бұрын
You can detect when an overflow or underflow would occur and guard against it, though in practice it's rarely needed. For instance, say you need to multiply two numbers and you can't just use a wider type, you can divide one into INT_MAX or UINT_MAX and test if the result is bigger than the other number. If using signed int's, be careful with negative numbers, and always check for 0 when dividing.
@jeanchristophemahalomba2240
@jeanchristophemahalomba2240 2 жыл бұрын
I really like all of the tutorials from this channel, however i have a hard time to understand what the speaker says because it's a bit fast, it's kind from him if he speaks a bit slowly.🙂
@livingcodex9878
@livingcodex9878 2 жыл бұрын
おはようございます
@_b7090
@_b7090 Жыл бұрын
But how do I know that the checksum isn't corrupted 🤨
@JacobSorber
@JacobSorber Жыл бұрын
You don't, but the idea is that it's unlikely that the packet and the checksum will both be corrupted in a way that they still match. The better the checksum the less likely it is.
@toastyPredicament
@toastyPredicament Жыл бұрын
>had Bluetooth on >Backup incomplete.
@livingcodex9878
@livingcodex9878 2 жыл бұрын
Moin
@Arbiteroflife
@Arbiteroflife 2 жыл бұрын
I think a cryptographically secure hash would be better I think. It has these problems figured out in that it is preimage image resistant, Second pre-image resistant, and collision resistant. They also value speed of taking the hash. en.wikipedia.org/wiki/Cryptographic_hash_function
Sockets and Pipes Look Like Files (Unix/fdopen)
12:45
Jacob Sorber
Рет қаралды 18 М.
Why are Progress Bars Always Wrong? Progress Bar Example in C.
35:44
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 96 МЛН
Is memcpy dangerous?
14:08
Jacob Sorber
Рет қаралды 23 М.
Checksums and Hamming distance
28:21
Ben Eater
Рет қаралды 214 М.
What's the Best Way to Copy a Struct in C and C++?
13:44
Jacob Sorber
Рет қаралды 33 М.
Pulling Back the Curtain on the Heap
21:38
Jacob Sorber
Рет қаралды 36 М.
How to Check Your Pointers at Runtime
14:12
Jacob Sorber
Рет қаралды 31 М.
What is CHECKSUM? | CRYPTOGRAPHIC HASH FUNCTIONS
3:54
Amohig Code
Рет қаралды 8 М.
Making a calculator from scratch - #SoME3
24:25
VoxelRifts
Рет қаралды 29 М.
The What, How, and Why of Void Pointers in C and C++?
13:12
Jacob Sorber
Рет қаралды 51 М.