MCPcopy
hub / github.com/npmx-dev/npmx.dev / simpleHash

Function simpleHash

shared/utils/atproto.ts:8–14  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

6
7// A very simple hasher to get an offset for blog posts on the same day
8const simpleHash = (str: string): number => {
9 let h = 0
10 for (let i = 0; i < str.length; i++) {
11 h = ((h << 5) - h + str.charCodeAt(i)) >>> 0
12 }
13 return h
14}
15
16// Parse date from frontmatter, add slug-path entropy for same-date collision resolution
17export const generateBlogTID = (dateString: string, slug: string): string => {

Callers 1

generateBlogTIDFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected