Lint files
This commit is contained in:
parent
2f7cad602a
commit
ff5af8aea5
11 changed files with 184 additions and 276 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue