String to unique integer hashing

前端 未结 7 1381
日久生厌
日久生厌 2020-12-18 18:49

I\'m trying to develop a system that can change my string into a unique integral value, meaning say for example the word \"account\" has an encrypted numerical value of 0891

7条回答
  •  天命终不由人
    2020-12-18 18:57

    You can do this:

    SEPARETOR = '000'
    string_to_hash = "some_string"
    hashed_result = int(SEPARETOR.join(list(str(ord(character)) for character in string_to_hash)))
    

    Enjoy!

提交回复
热议问题