chen870647924 / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Human readable UUID / Hash #894

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

  might be a stupid idea but i often find myself in the position where i assign local UIDs to things like SocketConnection and put them out in a log then.

I wondered if i should write myself an UUID function which gives out 
human-readable hashes (which need to be handed back to later). Some thing like 
"apples","oranges","bananas", or "blue","red".

Or just an ID that is only as long as it needs to be to be locally - unique and 
tries to use a different prefix as often as possible.

Original issue reported on code.google.com by fabian.z...@gmail.com on 7 Feb 2012 at 2:51

GoogleCodeExporter commented 9 years ago
May I recommend a base 58 encoding?

Original comment by emily@soldal.org on 15 Feb 2012 at 10:12

GoogleCodeExporter commented 9 years ago
Sounds interesting, thanks for the tip.

Original comment by fabian.z...@gmail.com on 15 Feb 2012 at 10:18

GoogleCodeExporter commented 9 years ago
This might be of interest;
http://code.google.com/p/bccapi/source/browse/trunk/src/com/bccapi/core/Base58.j
ava?spec=svn53&r=53

Original comment by emily@soldal.org on 15 Feb 2012 at 10:23

GoogleCodeExporter commented 9 years ago
Thank you again.

Original comment by fabian.z...@gmail.com on 15 Feb 2012 at 10:25

GoogleCodeExporter commented 9 years ago
You would have to be *extremely* space constrained to want to use base58 over 
base32.  Base58 is slower and gets *exponentially* slower as inputs get larger.

Original comment by kevinb@google.com on 15 Feb 2012 at 5:13

GoogleCodeExporter commented 9 years ago
While this is true, base58 is "shorter" and easier to convey by voice or to
copy down by hand. It has a more human aspect to it.

Original comment by emily@soldal.org on 15 Feb 2012 at 5:15

GoogleCodeExporter commented 9 years ago
It's less than 15% shorter, on average.

As for conveying by voice, etc., the need to communicate whether each character 
is upper-case or lower-case is imho a serious impediment that base 32 doesn't 
have to deal with. I would much rather take dictation of a 15%-longer base 32 
string.

Original comment by kevinb@google.com on 16 Feb 2012 at 3:08

GoogleCodeExporter commented 9 years ago
...I've got to ask: 

Who would voice dictate a hash?  What possible reason is there?

I just can't imagine why anyone would actually do this.

Original comment by wasserman.louis on 16 Feb 2012 at 6:42

GoogleCodeExporter commented 9 years ago
I've had to do this myself actually, but to demonstrate;
"Oh hey, you have to check out this youtube video of some cats!
So.. goto youtube dot com slash v equals big-I little-y little-t big-N-B
little-m number-eight big-W-A number-1 small-c.
Its so funny!"
The code here would be "IytNBm8WA1c", its not perfect... but it seems to be
standard around the web, my thoughts are that it has to do with
communication, but perhaps there are other reasons that smarter people than
I have discovered.

Original comment by emily@soldal.org on 16 Feb 2012 at 8:31

GoogleCodeExporter commented 9 years ago
Assuming you aren't bothered about the size use base32 and split it into 4 or 6 
characters with hyphens etc in the log to make it more readable, or give them a 
tool to present it that way when they query it. ABCD-EFGH...

Original comment by MGHawksw...@gmail.com on 16 Feb 2012 at 10:01

GoogleCodeExporter commented 9 years ago
Would we be doing this just as a HashCode.toString() implementation?

Original comment by wasserman.louis on 20 Feb 2012 at 5:14

GoogleCodeExporter commented 9 years ago
Converting hash codes to natural language sentences doesn't seem like a good 
fit for Guava.

Original comment by fry@google.com on 13 Mar 2012 at 6:32

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:14

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08