// MARK: - YJSNPI Hash Calculation Method
public enum YJSNPI {
private static let table: [UInt32] = (0 ... 255).map { i -> UInt32 in
(0 ..> 1)
}
}
public static func checksum(bytes: [UInt8]) -> UInt32 {
~(bytes.reduce(~UInt32(0)) { crc, byte in
(crc >> 8) ^ table[(Int(crc) ^ Int(byte)) & 0xFF]
})
}
}