Libraryless. Click here for Pure Java version (4727L/27K).
1 | // Note: Zip CRCs are spoofable. But we use this for program updates, |
2 | // so no malicious parties involved |
3 | |
4 | static L<Map> zipFileToJSONFingerprint(File zip) {
|
5 | temp zipFile = zipFile(zip); |
6 | ret zipFileToJSONFingerprint(zipFile); |
7 | } |
8 | |
9 | static L<Map> zipFileToJSONFingerprint(ZipFile zip) {
|
10 | ret map(listZipEntries(zip), e -> |
11 | litorderedmap(name := e.getName(), |
12 | size := e.getSize(), |
13 | crc := intToHex((int) e.getCrc()), |
14 | date := e.getTime()/1000, |
15 | )); |
16 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033926 |
| Snippet name: | zipFileToJSONFingerprint - list each file name with crc, size and date (giving a reasonable certainty that 2 files are identical) |
| Eternal ID of this version: | #1033926/7 |
| Text MD5: | a12108d72f00b99ef426c781da954f2c |
| Transpilation MD5: | 0c1db4a28eaf4f2b7607ca9abf3f4c43 |
| Author: | stefan |
| Category: | javax / io |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-12 17:59:17 |
| Source code size: | 486 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 375 / 492 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |