iOS: consolidate SHA-256 hashing into a shared utility - #47
Conversation
0a49aa1 to
d648e54
Compare
There was a problem hiding this comment.
Pull request overview
Consolidates iOS SHA-256 hashing into a reusable utility and reduces memory usage through chunked file reads.
Changes:
- Adds shared data and file hashing functions.
- Migrates update-manifest hashing to the utility.
- Propagates file-hashing failures through existing error paths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
ios/CodePush/CodePushUpdateUtils.m |
Uses shared hashing functions and handles failures. |
ios/CodePush/CodePushSha256.m |
Implements SHA-256 hashing for data and streamed files. |
ios/CodePush/CodePushSha256.h |
Declares the shared hashing interface. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
d648e54 to
eb3db6c
Compare
eb3db6c to
5b1c56d
Compare
5b1c56d to
35dfdb1
Compare
6dd99d3 to
bb07518
Compare
| + (void)addFileToManifest:(NSURL *)fileURL | ||
| + (BOOL)addFileToManifest:(NSURL *)fileURL | ||
| manifest:(NSMutableArray *)manifest | ||
| error:(NSError **)error |
There was a problem hiding this comment.
File reading errors were previously unhandled, that's why the signature is changing (standard ObjC error handling pattern).
bb07518 to
a327bf7
Compare
a327bf7 to
f5062ad
Compare
f5062ad to
1002f17
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The tvOS target omits the new implementation and will fail to link.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Balanced
| CC_SHA256_CTX context; | ||
| CC_SHA256_Init(&context); | ||
|
|
||
| static const NSUInteger kChunkSize = 1024 * 8; |
There was a problem hiding this comment.
1002f17 to
11e4e4d
Compare
Split off from #48, I didn't want to bloat that PR with unrelated changes. We'll be doing additional SHA-256 checksumming in new codepaths, let's extract hashing code to a common utility.
As a bonus, existing callers which loaded entire files into memory are now loading data in smaller chunks.