Skip to content

Commit 60ca9ba

Browse files
authored
fsb: resolve hashing errors (#379)
1 parent 072287a commit 60ca9ba

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

fsb/src/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ macro_rules! fsb_impl {
197197
truncated[0] = array[starting_byte] << (bits_in_cue - shift_value as u8);
198198
truncated[0] ^= array[0] >> shift_value;
199199
for position in 1..Self::SIZE_OUTPUT_COMPRESS {
200-
truncated[position] ^= array[position - 1] >> (8 - shift_value);
201-
truncated[position] ^= array[position] << shift_value;
200+
truncated[position] ^= array[position - 1] << (8 - shift_value);
201+
truncated[position] ^= array[position] >> shift_value;
202202
}
203203
} else {
204204
// First we need to decide which is the last byte and bit that will go to the first position.

fsb/tests/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn fsb160_rand() {
1515
feed_rand_16mib(&mut h);
1616
assert_eq!(
1717
h.finalize()[..],
18-
hex!("454b28a8d158ad63ff59e3f761919c7581ee78d3")[..]
18+
hex!("40b7538be5e51978690d1a92fe12a7f25f0a7f08")[..]
1919
);
2020
}
2121

@@ -25,7 +25,7 @@ fn fsb224_rand() {
2525
feed_rand_16mib(&mut h);
2626
assert_eq!(
2727
h.finalize()[..],
28-
hex!("80ef345c462dc88261355eaf44ee2bb7277d01db77b46b2828a918b6")[..]
28+
hex!("0ec203ccec7cbf0cadd32e5dc069d0b4215a104c4dad5444944a0d09")[..]
2929
);
3030
}
3131

@@ -35,7 +35,7 @@ fn fsb256_rand() {
3535
feed_rand_16mib(&mut h);
3636
assert_eq!(
3737
h.finalize()[..],
38-
hex!("301cbfd7031de3568bf4c4ffa86c2295bde89937acc8ee470446b8c55b88334a")[..]
38+
hex!("eecb42832a2b03bc91beb1a56ddf2973c962b1aeb22f278e9d78a7a8879ebba7")[..]
3939
);
4040
}
4141

@@ -47,8 +47,8 @@ fn fsb384_rand() {
4747
assert_eq!(
4848
h.finalize()[..],
4949
hex!("
50-
d11c0ea4ef363916ad8c2a4d8b4758bf0c36e4de93f2bbaeba037b0726c83179
51-
0ec4e5d9d3e9d66e0810d391a00bf60e
50+
f17533ed4d4484434715e63bc8e801c9cfe988c38d47d3b4be0409571360aa2f
51+
b360b2804c14f606906b323e7901c09e
5252
")[..]
5353
);
5454
}
@@ -61,8 +61,8 @@ fn fsb512_rand() {
6161
assert_eq!(
6262
h.finalize()[..],
6363
hex!("
64-
eb15b6c3626e38141e4f17b3b89d7deed007c4ae727452010601bc4e16deef82
65-
f81415566defb1aba3db9b1b14746bd81cf3689a0f79e6d00434ff4ca19b3e66
64+
957a7733643e075ab7a3b04607800a6208a26b008bdaee759a3a635bb9b5b708
65+
3531725783505468bf438f2a0a96163bbe0775468a11c93db9994c466b2e7d8c
6666
")[..]
6767
);
6868
}

0 commit comments

Comments
 (0)