Hash function to produce a code of 30 chars?
问题 I need to hash a message into a string of 30 chars. What's the best and most secure hash function for this usage? 回答1: Thirty characters (bytes) is 240 bits. If you can't move the goal-post to allow 32 characters, then you will probably end up using SHA-1, which generates 160-bits or 20 bytes. When Base-64 encoded, that will be 28 characters. If you use a hex-encoding, it will be 40 characters, which is nominally out of range. With 32 characters, you could use SHA-256, but Base-64 encoding