aboutsummaryrefslogtreecommitdiff
path: root/src/zip/encryption.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/zip/encryption.rs')
-rw-r--r--src/zip/encryption.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/zip/encryption.rs b/src/zip/encryption.rs
index 76824a1..f317245 100644
--- a/src/zip/encryption.rs
+++ b/src/zip/encryption.rs
@@ -7,22 +7,22 @@ const TABLE: [u32; 256] = generate_table();
7const fn generate_table() -> [u32; 256] { 7const fn generate_table() -> [u32; 256] {
8 let mut table = [0; 256]; 8 let mut table = [0; 256];
9 9
10 let mut b = 0; 10 let mut i = 0;
11 while b <= 255 { 11 while i <= 255 {
12 let mut crc = b as u32; 12 let mut t = i as u32;
13 13
14 let mut i = 0; 14 let mut j = 0;
15 while i < 8 { 15 while j < 8 {
16 if (crc & 1) > 0 { 16 if (t & 1) > 0 {
17 crc = (crc >> 1) ^ 0xEDB88320 17 t = (t >> 1) ^ 0xEDB88320
18 } else { 18 } else {
19 crc >>= 1 19 t >>= 1
20 } 20 }
21 i += 1; 21 j += 1;
22 } 22 }
23 23
24 table[b] = crc; 24 table[i] = t;
25 b += 1 25 i += 1
26 } 26 }
27 27
28 table 28 table