Binary data exercise: how to tell if a file is a jpeg?

preview_player
Показать описание
---
Binary data exercise: how to tell if a file is a jpeg? // today I thought we would look at binary data, in the form of JPG images, and specifically see if we can write a program that will test whether or not a file is JPEG. We're looking at this in both C and Ruby, so you can see some of the pitfalls that you can run into with higher-level languages.

Related Videos:

***

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:

To Support the Channel:
+ like, subscribe, spread the word

Рекомендации по теме
Комментарии
Автор

The read method in ruby has an option for encoding, e.g. f.read(3, encoding="UTF-8")

litlkaiser
Автор

Lets have a deep dive into the meta data

suncrafterspielt
Автор

Definitely would be interested if more file format videos are to come :)

NonTwinBrothers
Автор

"Strings are strings; bytes are bytes." That's the way it should always be! Good video.

zrodger
Автор

Thank you for the example! Really a good intro to magic bytes 🙂 Maybe another nice video would be a simple jfif/exif low-level parser - just the big stuff - display the block type and size, could be useful for integrity check 🙂 most out-of-the-box libraries “fix” minor errors or ignore erroneous information when possible.

bolter
Автор

I love your vids... they helped me understand pointers :)

valsk
Автор

Python3 doesn't have this problem: as you can read directly binary and get "bytes" objects.

unperrier
Автор

a video on reading/writing bitmap data would be cool :)

pseudopseudo
Автор

Interesting. I’m taking a python course currently. This will make an interesting exercise in python. Thanks! 😀

donaldmickunas
Автор

Yes for metadata and more file disassembly please!

reverse_shell
Автор

❤ This is one of my favorites! A real world example. Unix/Linux has "magic" built in, and I've edited /etc/magic by hand to add file types, but I do data migrations, so this indepth how-to is very helpful for building custom tools myself regardless of platform. It maybe a bit off the channel topic, but it might be useful for you to do a video on encoding - ASCII, UTF, ISO, EBCDIC - and maybe even add byte transmission like 7bit even parity, 8bit no parity...stuff like that. Working at the atomic level of data is very helpful to develop a better understanding of computers in general.

rexjuggler
Автор

I would love more videos on this topic!

samuelmartin
Автор

I would love to see some videos on binary file manipulation, especially something like writing your own encryption program.

robertstrickland
Автор

feeling like home when somebody types things in C. Things are exactly what they are in 99%, and 1% stays just for rare machines’ unique memory conventions, and nothing else.

DelgardAlven
Автор

I love this way of questioning everything. Next: How to tell if a JPEG is a file.

andreisoceanu
Автор

That's pretty cool. I've never tried to do this before.

coolbrotherf
Автор

basically an oddly specific version of "file" command/program

minhajsixbyte
Автор

Could you check if it is not a real jpg but may have some hidden data within the file?

gerdsfargen
Автор

Just found out about this channel. Nice content!

raul_ribeiro_bonifacio
Автор

Great video as usual, What is the proper way to exit a or with "return EXIT_FAILURE"...or use EXIT_SUCCESS...not sure when to use "return" or "exit" to end the program.

eddaly