xar unarchiver (.xar, .pkg, .xip)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add toc checksumming

+6 -3
+6 -3
czar.cr
··· 148 148 file.seek heap_start + xar.checksum.offset 149 149 stored_checksum_data = Bytes.new(xar.checksum.size) 150 150 file.read(stored_checksum_data) 151 - stored_checksum = String.new(stored_checksum_data).strip 151 + stored_checksum = stored_checksum_data.hexstring 152 152 153 153 if calculated.downcase == stored_checksum.downcase 154 154 puts "✓ Heap checksum valid (#{xar.checksum.style})" ··· 263 263 zfile.read toc_data 264 264 end 265 265 266 - # TODO: toc checksum 267 - 268 266 xar_xml = XML.parse String.new(toc_data) 269 267 xar_obj = xml_select(xar_xml, "xar") 270 268 perror "empty xar object" if xar_obj.empty? ··· 281 279 xar.checksum.size = xml_value(elem, "size").first.to_u64 282 280 xar.checksum.offset = xml_value(elem, "offset").first.to_u64 283 281 puts "TOC is checksummed as #{xar.checksum.style}, #{xar.checksum.size} bytes at offset #{xar.checksum.offset}" 282 + 283 + file.seek xar.checksum.offset 284 + toc_checksum = Bytes.new xar.checksum.size 285 + file.read(toc_checksum) 286 + validate_checksum(toc_data, toc_checksum.hexstring, xar.checksum.style, "TOC") 284 287 285 288 xml_select(toc, "file").each do |entity| 286 289 xar.files += xar_decode_file entity