https://github.com/katharostech/xorio
Rust library for XOR-ing Read/Write Streams
https://github.com/katharostech/xorio
rust
Last synced: 4 months ago
JSON representation
Rust library for XOR-ing Read/Write Streams
- Host: GitHub
- URL: https://github.com/katharostech/xorio
- Owner: katharostech
- License: other
- Created: 2021-02-04T18:41:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-04T21:57:40.000Z (over 5 years ago)
- Last Synced: 2025-06-05T07:16:59.489Z (about 1 year ago)
- Topics: rust
- Language: Rust
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# xorio
[](https://crates.io/crates/xorio)
[](https://docs.rs/xorio)
[](https://github.com/katharostech/katharos-license)
[`Read`]/[`Write`] implementation that Xor's the bytes that come through it and wraps around
another [`Read`] or [`Write`].
## Examples
### Writing
```rust
let mut file = File::create("my_xored_file.bin").unwrap();
let mut writer = Xor::new(file);
writer.write_all("Hello World".as_bytes());
```
### Reading
```rust
let mut file = File::open("my_xored_file.bin").unwrap();
let mut reader = Xor::new(file);
let mut content = String::new();
reader.read_to_string(&mut content);
```
### Custom Xor Bytes
You can also customize the bytes that it will XOR the stream with. By default it uses a single
byte `0b01010101` to calculate the XOR.
```rust
let mut file = File::create("my_xored_file.bin").unwrap();
let mut writer = Xor::new_with_xor_bytes(file, vec![1, 2, 3]);
writer.write_all("Hello World".as_bytes());
```
## License
Bevy LDtk is licensed under the [Katharos License][k_license] which places certain restrictions
on what you are allowed to use it for. Please read and understand the terms before using Bevy
LDtk for your project.
[k_license]: https://github.com/katharostech/katharos-license
[`Read`]: https://doc.rust-lang.org/stable/std/io/trait.Read.html
[`Write`]: https://doc.rust-lang.org/stable/std/io/trait.Write.html