“Alphanumeric” hash - A-Z, 0-9

后端 未结 2 1010
盖世英雄少女心
盖世英雄少女心 2021-02-13 04:39

I\'m looking for a function that will generate an \"alphanumeric hash\". Given a source string, it produces a determinate result string that can contain any letter a-z or digit

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-13 05:27

    How about generating your SHA256 and then Base36 encoding the result? No left over bits, no bias...

    That way you have the cryptographic strength of a proven algorithm (remember to salt and use multiple hash iterations) along with the alphanumeric representation that you need.

提交回复
热议问题