Parse Dat protocol SLEEP files.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
fuzz Add fuzzer (#5) Jun 5, 2018
src remove trailing zero verification (#13) Dec 28, 2018
tests edition 2018 (#11) Dec 28, 2018
.gitignore ignore .dat Jul 5, 2018
.travis.yml work on stable (#10) Oct 18, 2018
CERTIFICATE . Mar 22, 2018
CHANGELOG.md Update changelog Dec 28, 2018
Cargo.toml
LICENSE-APACHE dual license Mar 30, 2018
LICENSE-MIT Relicense to MIT OR Apache-2.0 Mar 30, 2018
README.md
rustfmt.toml

README.md

sleep-parser

crates.io version build status downloads docs.rs docs

Parse Dat protocol SLEEP files.

Usage

extern crate sleep_parser as sleep_parser;

use sleep_parser::{FileType, HashType, Header};
use std::fs::File;
use std::io::{BufRead, BufReader};

let file = File::open("tests/fixtures/content.bitfield").unwrap();
let mut reader = BufReader::with_capacity(32, file);
let buffer = reader.fill_buf().unwrap();
let header = Header::from_vec(&buffer).unwrap();
assert!(header.is_bitfield());

Format

<32 byte header>
  <4 byte magic string: 0x05025702>
  <1 byte version number: 0>
  <2 byte entry size: 40>
  <1 byte algorithm name length prefix: 7>
  <7 byte algorithm name: BLAKE2b>
  <17 zeroes>
<40 byte entries>
  <32 byte BLAKE2b hash>
  <8 byte Uint64BE children leaf byte length>

Installation

$ cargo add sleep-parser

License

MIT or Apache-2.0