Revert "[web]implement in-house sha1 hash function (#18651)" (#18703)

This reverts commit aa3f5ab3ff412696c715521381eebf176f503197.

GitOrigin-RevId: b2be3907439525f3ed49baec0b438ba35ea1663c
This commit is contained in:
Liangjun Song
2024-06-05 08:03:57 +00:00
committed by Copybot
parent 55c342134c
commit 432fbd3c40
6 changed files with 9 additions and 227 deletions
@@ -1,5 +1,5 @@
// @ts-ignore
import { generateSHA1Hash } from '../../../shared/utils/sha1'
import CryptoJSSHA1 from 'crypto-js/sha1'
import {
createContext,
useContext,
@@ -94,9 +94,9 @@ export const ReferencesProvider: FC = ({ children }) => {
const docId = doc.doc_id
const snapshot = doc._doc.snapshot
const now = Date.now()
const sha1 = generateSHA1Hash(
const sha1 = CryptoJSSHA1(
'blob ' + snapshot.length + '\x00' + snapshot
)
).toString()
const CACHE_LIFETIME = 6 * 3600 * 1000 // allow reindexing every 6 hours
const cacheEntry = existingIndexHash[docId]
const isCached =