Lint files

This commit is contained in:
Andras Schmelczer 2024-12-20 16:14:46 +00:00
parent 2f7cad602a
commit ff5af8aea5
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
11 changed files with 184 additions and 276 deletions

View file

@ -1,11 +1,12 @@
// https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
export function hash(content: Uint8Array): string {
let hash = 0;
let result = 0;
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < content.length; i++) {
hash = (hash << 5) - hash + content[i];
hash |= 0; // convert to 32bit integer
result = (result << 5) - result + content[i];
result |= 0; // Convert to 32bit integer
}
return hash.toString(16);
return Math.abs(result).toString(16);
}
export const EMPTY_HASH = hash(new Uint8Array(0));