Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace sha1 hash with simpler algorithm #489

Open
zerobias opened this issue Jun 24, 2024 · 0 comments
Open

Replace sha1 hash with simpler algorithm #489

zerobias opened this issue Jun 24, 2024 · 0 comments

Comments

@zerobias
Copy link
Collaborator

Sha1 implementation in farfetched is very large and probably not so fast. We don't need cryptography-grade implementation for that case, so we can pick much simpler implementation from effector/babel-plugin:

function hashCode(s: string) {
  let h = 0
  let i = 0
  while (i < s.length) h = ((h << 5) - h + s.charCodeAt(i++)) | 0
  return h.toString(36)
}

It's came from java and battle-tested in effector itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant