8000 detecting binary blob types · Issue #11 · dominictarr/cyphernet · GitHub
[go: up one dir, main page]

Skip to content

detecting binary blob types #11

Open

Description

@dominictarr

There is a general problem of detecting the type of an object.
json is easy to detect, but it can't do binary.

For example, bitcoin and git would fit into cyphernet,
if there was a simple way to detect how what type of object a blob is,
and parse it correctly.

It may be necessary to interpret the object's type from context.
I.e. we know that a git commit links to a previous commit and a tree.

Also, it may be necessary to use allow different hashes.
I doubt that all these systems use sha1.

Activity

  1. ralphtheninja commented on Sep 5, 2013

    @ralphtheninja

    Cyphernet could pick a type of hash and stick to that, say sha256 as an example. If other types of hashes are used when quering cyphernet, you could just hash the hashes to the correct one. Instead of storing a blob with a hash, you store it with the hash of the hash. So if the first hash is sha256 or something else, it doesn't really matter, because the hash of the hash should also be unique. Did that make any sense?

  2. dominictarr commented on Sep 5, 2013

    @dominictarr
    OwnerAuthor

    well, that won't work if some blob has a hash of another type in it, we want to beable to interpret that as a link, but we can't change the blob, because it would change it's hash. probably we'd have to have selected secondary indexes by hash different hash types, if there are other popular ones that are not sha.

  3. dominictarr commented on Sep 5, 2013

    @dominictarr
    OwnerAuthor

    okay, investigating which hash types are used.

    git uses sha1.

    hmm, okay, bitcoin does loads of weird stuff.
    https://en.bitcoin.it/wiki/Protocol_specification#Hashes

    git is easy though,

    cat .git/objects/5a/dfe563b1e04e24c5014a3fde1bb7d069f1d970 | node -e  'process.stdin.pipe(require("zlib").createUnzip()).pipe(process.stdout)'
    

    commits and blobs are plain text, and trees have binary, but still uses sha1.
    also, each object types is tagged.

    bittorrent mostly uses sha1, same as git. Also, bittorrent objects are bencoded,
    which is like a binary json.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0