The open source coding agent.
TypeScript
fix(util): checksum defensiveness
Adam03733b050598
diff --git a/packages/util/src/encode.ts b/packages/util/src/encode.tsindex bf6fa75dc28..138cf16086d 100644--- a/packages/util/src/encode.ts+++ b/packages/util/src/encode.ts@@ -19,8 +19,8 @@ export async function hash(content: string, algorithm = "SHA-256"): Promise<strireturn hashHex}-export function checksum(content: string): string {- if (!content) return ""+export function checksum(content: string): string | undefined {+ if (!content) return undefinedlet hash = 0x811c9dc5for (let i = 0; i < content.length; i++) {hash ^= content.charCodeAt(i)