0

I want to implement a problem solution that requires a hashing function that returns the same output for similar input. The input will be some code and I want the hashing function to ignore the variable names, etc.

If no such hashing function is available then how can I implement this using other hashing algorithms. Any suggestion, please?

1 Answers1

0

Most hashing functions are designed to do the opposite: If the input is different, even a tiny bit, they will most likely return a completely different value.

But maybe you could "normalize" your input first. Replace each unique variable name with a string, e.g. the first variable name with "var00000001", the next with "var00000002", etc. in the order of their first appearance.

Yurim
  • 923
  • 1
  • 17
  • 34