Transforming each character into another consistent character

Viewed 62

For example, there is a data entry like this -> "ADdfe3783i, .- ^ #"

This is a unique value and I want to create a new unique value using it. I want to take this unique ID and generate a new ID where each character will always be the same character.

If it consisted of only letters and numbers, it was easy by specifying the equivalents, but any character can come.

I will use it in Kotlin, Java or Swift languages. It would be better with this, but it doesn't matter, I can interpret and transform, the important thing is logic.

1 Answers

From what I understand, I think you want to use input to create some mapping of characters like where A = 1 , B = 2, .... And you want each input to have their own mapping.

If that is the case, you can try (you can omit encryption or SALT part) :

  1. Create a SALT key for your project.
  2. Append SALT key to input string.
  3. Encrypt it using any algorithm you like.
  4. Generate integer HASH of encrypted input.
  5. Now you can perform substitution cipher techniques using this integer HASH, to make sure you get same mapping every time for same input string.
Related