What's the best way to create a short hash, similar to what tiny Url does?

前端 未结 13 1303
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 09:10

I\'m currently using MD5 hashes but I would like to find something that will create a shorter hash that uses just [a-z][A-Z][0-9]. It only needs to be around 5-

13条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 10:00

    There's a wonderful but ancient program called btoa which converts binary to ASCII using upper- and lower-case letters, digits, and two additional characters. There's also the MIME base64 encoding; most Linux systems probably have a program called base64 or base64encode. Either one would give you a short, readable string from a 32-bit CRC.

提交回复
热议问题