Lemmy: Bestiverse
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
RSS BotMB to Hacker NewsEnglish · 2 months ago

Recommendations for designing magic numbers of binary file formats

hackers.town

external-link
message-square
0
fedilink
2
external-link

Recommendations for designing magic numbers of binary file formats

hackers.town

RSS BotMB to Hacker NewsEnglish · 2 months ago
message-square
0
fedilink
Zack Weinberg (@zwol@hackers.town)
hackers.town
external-link
another day, another binary file format with a badly designed magic number not gonna call it out specifically but here are some RFC2119 MUSTs for magic number design: MUST be the very first N bytes in the file MUST be at least four bytes long, eight is better MUST include at least one byte with the high bit set MUST include a byte sequence that is invalid UTF-8 SHOULD include a zero byte, but you can usually get away with having that be part of the overall version number that immediately follows the magic number (did I mention that you really SHOULD put an overall version number right after the magic number, unless you know and have documented exactly why it's not necessary, e.g. PNG?) good examples: * PNG * ELF bad examples: * GIF * PE * PDF

Comments

alert-triangle
You must log in or register to comment.

Hacker News

hackernews

Subscribe from Remote Instance

You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !hackernews@lemmy.bestiver.se
lock
Community locked: only moderators can create posts. You can still comment on posts.

Posts from the RSS Feed of HackerNews.

The feed sometimes contains ads and posts that have been removed by the mod team at HN.

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 306 users / day
  • 1.17K users / week
  • 3.67K users / month
  • 8.51K users / 6 months
  • 2 local subscribers
  • 1.32K subscribers
  • 20.6K Posts
  • 7.14K Comments
  • Modlog
  • mods:
  • patrick
  • RSS Bot
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org