Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose lookup tables #117

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/crc128/bytewise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ impl Crc<u128, Table<1>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<1> as Implementation>::Data<u128> {
&self.data
}
}

impl<'a> Digest<'a, u128, Table<1>> {
Expand Down
6 changes: 5 additions & 1 deletion src/crc128/slice16.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::table::crc128_table_slice_16;
use crate::{Algorithm, Crc, Digest, Table};
use crate::*;

use super::{finalize, init, update_slice16};

Expand Down Expand Up @@ -32,6 +32,10 @@ impl Crc<u128, Table<16>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<16> as Implementation>::Data<u128> {
&self.data
}
}

impl<'a> Digest<'a, u128, Table<16>> {
Expand Down
4 changes: 4 additions & 0 deletions src/crc16/bytewise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ impl Crc<u16, Table<1>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<1> as Implementation>::Data<u16> {
&self.data
}
}

impl<'a> Digest<'a, u16, Table<1>> {
Expand Down
6 changes: 5 additions & 1 deletion src/crc16/slice16.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::crc16::{finalize, init, update_slice16};
use crate::table::crc16_table_slice_16;
use crate::{Algorithm, Crc, Digest, Table};
use crate::*;

impl Crc<u16, Table<16>> {
pub const fn new(algorithm: &'static Algorithm<u16>) -> Self {
Expand Down Expand Up @@ -31,6 +31,10 @@ impl Crc<u16, Table<16>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<16> as Implementation>::Data<u16> {
&self.data
}
}

impl<'a> Digest<'a, u16, Table<16>> {
Expand Down
4 changes: 4 additions & 0 deletions src/crc32/bytewise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ impl Crc<u32, Table<1>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<1> as Implementation>::Data<u32> {
&self.data
}
}

impl<'a> Digest<'a, u32, Table<1>> {
Expand Down
6 changes: 5 additions & 1 deletion src/crc32/slice16.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::table::crc32_table_slice_16;
use crate::{Algorithm, Crc, Digest, Table};
use crate::*;

use super::{finalize, init, update_slice16};

Expand Down Expand Up @@ -32,6 +32,10 @@ impl Crc<u32, Table<16>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<16> as Implementation>::Data<u32> {
&self.data
}
}

impl<'a> Digest<'a, u32, Table<16>> {
Expand Down
4 changes: 4 additions & 0 deletions src/crc64/bytewise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ impl Crc<u64, Table<1>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<1> as Implementation>::Data<u64> {
&self.data
}
}

impl<'a> Digest<'a, u64, Table<1>> {
Expand Down
6 changes: 5 additions & 1 deletion src/crc64/slice16.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::table::crc64_table_slice_16;
use crate::{Algorithm, Crc, Digest, Table};
use crate::*;

use super::{finalize, init, update_slice16};

Expand Down Expand Up @@ -32,6 +32,10 @@ impl Crc<u64, Table<16>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<16> as Implementation>::Data<u64> {
&self.data
}
}

impl<'a> Digest<'a, u64, Table<16>> {
Expand Down
4 changes: 4 additions & 0 deletions src/crc8/bytewise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ impl Crc<u8, Table<1>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<1> as Implementation>::Data<u8> {
&self.data
}
}

impl<'a> Digest<'a, u8, Table<1>> {
Expand Down
6 changes: 5 additions & 1 deletion src/crc8/slice16.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::crc8::{finalize, init, update_slice16};
use crate::table::crc8_table_slice_16;
use crate::{Algorithm, Crc, Digest, Table};
use crate::*;

impl Crc<u8, Table<16>> {
pub const fn new(algorithm: &'static Algorithm<u8>) -> Self {
Expand Down Expand Up @@ -31,6 +31,10 @@ impl Crc<u8, Table<16>> {
let value = init(self.algorithm, initial);
Digest::new(self, value)
}

pub const fn table(&self) -> &<Table<16> as Implementation>::Data<u8> {
&self.data
}
}

impl<'a> Digest<'a, u8, Table<16>> {
Expand Down
Loading