From 950b3a07a3d349cc041d5d37e20dec682ad1c858 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sun, 30 Apr 2017 20:33:11 +0300 Subject: [PATCH] Added bzip2-related crc function and table. --- Sources/CheckSums.swift | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Sources/CheckSums.swift b/Sources/CheckSums.swift index 7df88a6e..d8dc9a3e 100644 --- a/Sources/CheckSums.swift +++ b/Sources/CheckSums.swift @@ -30,6 +30,15 @@ struct CheckSums { return ~crc } + static func bzip2CRC32(_ data: Data) -> UInt32 { + var crc: UInt32 = 0xFFFFFFFF + for i in 0..> 24) ^ index)] + } + return ~crc + } + static func crc64(_ array: [UInt8]) -> UInt64 { var crc: UInt64 = ~0 for i in 0..