Initial project import
This commit is contained in:
commit
23f2d29e32
11957 files changed
+1754577
No files matched your search
@@ -0,0 +1,51 @@
|
||||
# compress.bzip2
|
||||
|
||||
Pure V bzip2 encoder/decoder.
|
||||
|
||||
## Features
|
||||
|
||||
- Pure V implementation (no C wrappers)
|
||||
- bzip2 stream compression (`BZh1`..`BZh9`)
|
||||
- bzip2 stream decompression
|
||||
- Block and stream CRC validation
|
||||
- Deterministic output for identical input/params
|
||||
|
||||
## API
|
||||
|
||||
```v
|
||||
import compress.bzip2
|
||||
|
||||
compressed := bzip2.compress('hello'.bytes())!
|
||||
plain := bzip2.decompress(compressed)!
|
||||
assert plain.bytestr() == 'hello'
|
||||
```
|
||||
|
||||
With params:
|
||||
|
||||
```v
|
||||
import compress.bzip2
|
||||
|
||||
data := 'hello'.bytes()
|
||||
compressed := bzip2.compress(data, block_size: 1)!
|
||||
plain := bzip2.decompress(compressed, verify_crc: true)!
|
||||
assert plain.bytestr() == 'hello'
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Randomized legacy bzip2 blocks are intentionally rejected.
|
||||
- API currently works on full byte slices (no streaming interface yet).
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
v test vlib/compress/bzip2/
|
||||
```
|
||||
|
||||
## Proof
|
||||
|
||||
- tested against the official bzip2 C library using a variety of inputs and parameters.
|
||||
- deterministic and produces identical output for identical input and parameters.
|
||||
- includes CRC validation to ensure data integrity during compression and decompression.
|
||||
- rejects randomized legacy bzip2 blocks, ensuring only valid bzip2 streams are processed.
|
||||
- tested with a variety of inputs, including edge cases, to ensure robustness and reliability.
|
||||
Reference in new issue
Block a user