Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FNX Format

A small custom binary file format written in Python for learning how binary files work.

This project was created as an educational experiment to better understand:

  • Binary file structures
  • Serialization and deserialization
  • File headers
  • Magic numbers
  • Versioning
  • Binary I/O in Python
  • UTF-8 encoding

The format is intentionally simple. Its purpose is to demonstrate how custom binary formats are designed and parsed manually without relying on external libraries.


File Layout

Offset Size Description
0 4 bytes Magic number (PHOE)
4 1 byte Format version
5 4 bytes Message length
9 Variable UTF-8 encoded message

Example

A file containing:

Hello

is stored as:

50 48 4F 45
01
05 00 00 00
48 65 6C 6C 6F

Which represents:

  • Magic: PHOE
  • Version: 1
  • Message length: 5
  • Message: Hello

Limitations

FNX is a simple binary file format created for learning purposes. It is not designed to replace existing file formats or handle large-scale data storage.

Current limitations:

  • Single message storage: FNX files currently store only one UTF-8 text message. They do not support multiple objects, files, or complex data structures.

  • No compression: Data is stored exactly as written. Large messages may result in large file sizes.

  • No encryption or security features: FNX does not provide encryption, authentication, or protection against maliciously modified files.

  • Limited metadata: The format currently stores only a magic number, version number, message length, and message data. Additional metadata such as timestamps, authors, or file properties are not supported.

  • Fixed message length field: Message length is stored as a 4-byte unsigned integer, allowing a maximum size of approximately 4.29 GB for a single message.

  • No backward compatibility system: While FNX includes a version field, there is currently no support for automatically handling different format versions.


Features

  • Write custom .fnx files
  • Read existing .fnx files
  • Validate magic number
  • Version checking
  • UTF-8 message support

Project Structure

.
├── main.py
├── reader.py
├── writer.py
└── format.py

Purpose

This is not intended to be a production-ready file format.

The goal of this project is to learn how binary files are designed and how data is represented on disk before moving on to more advanced topics such as executable formats, filesystems, networking protocols, or operating system development.


License

MIT License.

About

A small custom binary file format built in Python to learn binary serialization, file structures, and low-level file I/O.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages