Convert MD5 to base62 for URL

前端 未结 9 500
再見小時候
再見小時候 2020-12-30 10:43

I have a script to convert to base 62 (A-Za-z0-9) but how do I get a number out of MD5?

I have read in many places that because the number from an MD5 is bigger than

9条回答
  •  情话喂你
    2020-12-30 11:22

    There actually is a Java implementation which you could probably extract. It's an open-source CMS solution called Pulse.

    Look here for the code of toBase62() and fromBase62().

    http://pulse.torweg.org/javadoc/src-html/org/torweg/pulse/util/StringUtils.java.html

    The only dependency in StringUtils is the LifeCycle-class which provides a way to get a salted hash for a string which you might even omit all together or just copy the method over to your copy StringUtils. Voilá.

提交回复
热议问题