this post was submitted on 30 Jan 2024
13 points (100.0% liked)

Technology

37720 readers
545 users here now

A nice place to discuss rumors, happenings, innovations, and challenges in the technology sphere. We also welcome discussions on the intersections of technology and society. If it’s technological news or discussion of technology, it probably belongs here.

Remember the overriding ethos on Beehaw: Be(e) Nice. Each user you encounter here is a person, and should be treated with kindness (even if they’re wrong, or use a Linux distro you don’t like). Personal attacks will not be tolerated.

Subcommunities on Beehaw:


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 2 years ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] mozz@mbin.grits.dev 9 points 9 months ago* (last edited 9 months ago)
  1. It's a 160-bit hash, so using letters and numbers, it'd be log base (10+26) of 2^160, which is roughly 31. So 31 letters.
  2. Using upper and lower case, it'd be log base (10+26+26) of 2^160, or 27 letters.
  3. Don't use SHA-1; use SHA-256
  4. Upper and lower case to represent SHA-256 would be log base (10+26+26) of 2^256, 43 letters
  5. Internally, it's represented using 32 "letters" of 8 bits each, effectively using every possible ASCII character. The string representation is only of consequence when you're exchanging it over a medium where it needs to be robust and human-readable, and probably the benefit from squeezing it down to fewer characters for that representation is not worth the cost in terms of making it unclear how you've chosen to squeeze it and making life difficult for people who are trying to convert to and from the format. Hexadecimal is a little bigger but it's very clear and unambiguous what you've done, whereas using the full alphabet doesn't have that property.