Skip to content

Instantly share code, notes, and snippets.

@mnutt
Created June 24, 2009 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnutt/135046 to your computer and use it in GitHub Desktop.
Save mnutt/135046 to your computer and use it in GitHub Desktop.

hid.im image format

A hidim is a torrent that is embedded inside of a 24-bit png. The data portion of a hidim does not need to fill the image.

Torrent data is read upward and to the right.

The torrent is broken up into 3-byte segments, and each segment represents red, green, and blue channels in a pixel.

Each hidim is identified by the hidim key:

[104, 105, 100, 105, 109, 32, 105, 115, 32, 116, 111, 114, 114, 101, 110, 116, 115, 33]

This byte array identifies the image as a hidim and marks the start of hidim data. The hidim reader starts at the hidim key, reads the metadata to determine the column height and data length, then reads column-by-column to the right until the data length has been reached.

image

Metadata format

Metadata is similar to bencoding and has the following attributes:

  1. line length -- bencoded integer
  2. filename -- bencoded string
  3. sha1 hash of .torrent file -- bencoded string
  4. data -- bencoded string

Example metadata:

i28304e14:ubuntu.torrent40:f572d396fae9206628714fb2ce00f72e94f2258f

Metadata is stacked together without separators. The data follows immediately after the metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment