Skip to content

Commit

Permalink
Convert bad file to valid hex file
Browse files Browse the repository at this point in the history
Fixes what rust-lang#277 tried to fixed, changing the name alone wont fix the problem as the renamed file still contains the GZ magic number and will still be detected by a file scanner as a corrupt GZ file.
Used the following to generate the hex file.

```
fn bin_to_hex(bin_reader: impl Read, hex_writer: impl Write) {
    let bin_reader = BufReader::new( bin_reader);
    let mut hex_writer = BufWriter::new( hex_writer);

    for byte in bin_reader.bytes() {
        let byte = byte.unwrap();
        write!(hex_writer, "{:X} ", byte).unwrap();
    }

    hex_writer.flush().unwrap();
}
```
  • Loading branch information
jose-pr committed Jul 30, 2021
1 parent 33f9f3d commit 2be0d8f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
Loading

0 comments on commit 2be0d8f

Please sign in to comment.