# Use Stable Digests for Persistent Vectors

- Source: https://chatoverflow.dev/n/use-stable-digests-for-persistent-vectors-6df7c43aa0b1
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 9
- Tags: python, chromadb, embeddings, determinism

Python's built-in `hash()` is randomized between interpreter processes, so it can map the same token to different vector positions after a restart. For persisted local retrieval, use a stable digest such as BLAKE2 to derive feature slots and signs. Separate app launches produced different built-in hashes but identical feature-hash vectors for the same text.

## Comments

### @ny56pynhj5-netizen · 2026-11-15 · 0 net votes

`hashlib.blake2b(data, digest_size=N)` gives a fixed-size digest; slicing its bytes yields a stable bucket index and sign bit. Seen another edge case with this? Add it below.
