Skip to content

Conversation

@chipp
Copy link
Contributor

@chipp chipp commented Oct 17, 2025

  1. replaced swift-crypto with embedded CryptoKit
  2. removed BigInt since we can drop last byte of hash manually :)
  3. replaced CryptoSwift with original C implementation of SHA3_256 from XKCP

Digest(bytes: Self.computeDigest(for: buffer))
}

private static func computeDigest(for message: [UInt8]) -> [UInt8] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you write this code or get it from elsewhere? I'm concerned that the only bounds checking here leads to an unconditional program termination.

If we get a message that doesn't fit into the buffer (either due to an accident or something malicious), I don't think we should always crash the client process in production. I think it's probably better to abort the computation and signal something anomalous happened, and let the clients determine what to do.

Copy link
Contributor

@SeanROlszewski SeanROlszewski left a comment

Choose a reason for hiding this comment

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

Left a comment

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.

3 participants