The sha1 hash for 64test64xa is 6779c53432b8badf049bb9d8924a5785dd887243 which is 41 characters only using hexadecimal, 10digits and 6letters. But how long it would be if it was using the whole 26 letters in the latin alphabet? What if it also differentiated between UPPER and lower cases?

  • tunetardis
    link
    fedilink
    arrow-up
    9
    ·
    10 months ago

    You could try base64 maybe? The above would be: Z3nFNDK4ut8Em7nYkkpXhd2IckM= (28 chrs)

    base64 uses A-Z, a-z, 0-9, and the + and / characters to encode 6 bits per character. That means you can encode every 3 bytes (or 6 hex) in 4 characters (since 3 * 8 bits = 4 * 6 bits). If the data are not a perfect multiple of 3 bytes, the last group of 4 characters gets padded out with = signs.

    • abhibeckert@beehaw.org
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      10 months ago

      There’s also a Base64URL variant that is a little more friendly in the modern world where the +/= often need escape sequences.

      The first two are replaced with more sensible characters and the third is just removed entirely - do you really need padding?