Skip to content

iOS: consolidate SHA-256 hashing into a shared utility - #47

Open
ofalvai wants to merge 1 commit into
ios-bspatch-integrationfrom
ios-sha256-refactor
Open

iOS: consolidate SHA-256 hashing into a shared utility#47
ofalvai wants to merge 1 commit into
ios-bspatch-integrationfrom
ios-sha256-refactor

Conversation

@ofalvai

@ofalvai ofalvai commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

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.

@ofalvai ofalvai changed the title ios sha256 refactor iOS: consolidate SHA-256 hashing into a shared utility Aug 27, 2026
@ofalvai
ofalvai requested a balanced review from Copilot August 28, 2026 14:18
@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch from 0a49aa1 to d648e54 Compare August 28, 2026 14:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ios/CodePush/CodePushUpdateUtils.m
Comment thread ios/CodePush/CodePushSha256.m Outdated
@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch from d648e54 to eb3db6c Compare August 28, 2026 14:44
@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch from eb3db6c to 5b1c56d Compare August 31, 2026 12:09
@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch from 5b1c56d to 35dfdb1 Compare September 3, 2026 10:48
@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch 2 times, most recently from 6dd99d3 to bb07518 Compare September 8, 2026 10:50
+ (void)addFileToManifest:(NSURL *)fileURL
+ (BOOL)addFileToManifest:(NSURL *)fileURL
manifest:(NSMutableArray *)manifest
error:(NSError **)error

@ofalvai ofalvai Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File reading errors were previously unhandled, that's why the signature is changing (standard ObjC error handling pattern).

@ofalvai
ofalvai marked this pull request as ready for review September 8, 2026 11:00
@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch from bb07518 to a327bf7 Compare September 9, 2026 06:36
@ofalvai
ofalvai removed this pull request from stack #41 September 9, 2026 06:38
@ofalvai
ofalvai added this pull request to stack #57 September 9, 2026 06:42
@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch from a327bf7 to f5062ad Compare September 9, 2026 09:57
@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch from f5062ad to 1002f17 Compare September 9, 2026 10:34
@ofalvai
ofalvai requested a balanced review from Copilot September 9, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread ios/CodePush.xcodeproj/project.pbxproj
CC_SHA256_CTX context;
CC_SHA256_Init(&context);

static const NSUInteger kChunkSize = 1024 * 8;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ofalvai
ofalvai force-pushed the ios-sha256-refactor branch from 1002f17 to 11e4e4d Compare September 9, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants