(str: string)
| 507 | // Simple hash function for content-based keys |
| 508 | // Using djb2 algorithm - fast and good distribution |
| 509 | function hashString(str: string): string { |
| 510 | let hash = 5381 |
| 511 | for (let i = 0; i < str.length; i++) { |
| 512 | hash = ((hash << 5) + hash) ^ str.charCodeAt(i) |
| 513 | } |
| 514 | // Convert to unsigned 32-bit and then to base36 for shorter keys |
| 515 | return (hash >>> 0).toString(36) |
| 516 | } |
| 517 | |
| 518 | interface ParsedBlock { |
| 519 | content: string |