teableio/teable

View on GitHub
apps/nestjs-backend/src/utils/string-hash.ts

Summary

Maintainability
A
0 mins
Test Coverage
export const string2Hash = (str: string) => {
  let hash = 5381;
  let i = str.length;

  while (i) {
    hash = (hash * 33) ^ str.charCodeAt(--i);
  }

  return hash >>> 0;
};