#bsa #hash #morrowind

no-std bsa3-hash

The hash function used in BSA files for *The Elder Scrolls III: Morrowind*

4 stable releases

3.0.0 Nov 14, 2021
2.0.0 Nov 12, 2021
1.0.2 Aug 29, 2019
1.0.1 May 26, 2019

#462 in Algorithms

Apache-2.0 OR MIT

1MB
14K SLoC

bsa3-hash

GitHub Actions Crates.io Docs.rs

bsa3-hash provides a Rust implementation of the hash function used in BSA files for The Elder Scrolls III: Morrowind.

Usage

Add bsa3-hash to your Cargo.toml:

[dependencies]
bsa3-hash = "^3.0.0"

Then call bsa3_hash::calculate as needed:

fn main() {
    assert_eq!(
        bsa3_hash::calculate(r"meshes\m\probe_journeyman_01.nif".as_bytes()),
        0x0002_0336, 0xBB50_0695
    );
}

Benchmarking

bsa3-hash supports benchmarking via criterion. Currently we test and benchmark against three data sets: the filename/hash lists from Morrowind.bsa, Tribunal.bsa and Bloodmoon.bsa. To run the benchmarks, simply do the following:

  • Install cargo-criterion, if you haven't already done so:
    cargo install cargo-criterion
    
  • Run cargo-criterion in the crate directory:
    cargo criterion
    

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps