Skip to content

Commit

Permalink
feat: add typedefs for Tlsh types with default sizes
Browse files Browse the repository at this point in the history
This will make it much easier to use the FromStr implementation,
as shown in the next commit.
  • Loading branch information
vthib committed Jul 30, 2023
1 parent 16b9494 commit f242ca9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,30 @@ pub use crate::tlsh::{Tlsh, TlshBuilder};

/// Builder with 256 buckets and a 1 byte checksum.
pub type TlshBuilder256_1 = TlshBuilder<256, 1, 64, 136, 50>;
/// TLSH with 256 buckets and a 1 byte checksum.
pub type Tlsh256_1 = Tlsh<1, 136, 64>;

/// Builder with 128 buckets and a 1 byte checksum.
pub type TlshBuilder128_1 = TlshBuilder<128, 1, 32, 72, 50>;
/// TLSH with 128 buckets and a 1 byte checksum.
pub type Tlsh128_1 = Tlsh<1, 72, 32>;

/// Builder with 48 buckets and a 1 byte checksum.
pub type TlshBuilder48_1 = TlshBuilder<48, 1, 12, 32, 10>;
/// TLSh with 48 buckets and a 1 byte checksum.
pub type Tlsh48_1 = Tlsh<1, 32, 12>;

/// Builder with 256 buckets and a 3 bytes checksum.
pub type TlshBuilder256_3 = TlshBuilder<256, 3, 64, 140, 50>;
/// TLSH with 256 buckets and a 3 bytes checksum.
pub type Tlsh256_3 = Tlsh<3, 140, 64>;

/// Builder with 128 buckets and a 3 bytes checksum.
pub type TlshBuilder128_3 = TlshBuilder<128, 3, 32, 76, 50>;
/// TLSH with 128 buckets and a 3 bytes checksum.
pub type Tlsh128_3 = Tlsh<3, 76, 32>;

/// Default builder, using 128 buckets and a 1 byte checksum.
pub type TlshDefaultBuilder = TlshBuilder128_1;
/// Default TLSH, using 128 buckets and a 1 byte checksum.
pub type TlshDefault = Tlsh128_1;

0 comments on commit f242ca9

Please sign in to comment.