Author

Topic: shortening hashes as a shortcut (Read 1150 times)

hero member
Activity: 602
Merit: 513
GLBSE Support [email protected]
April 14, 2011, 08:58:08 PM
#5
Thanks for the replies.

This is for the stock market, where shares that don't have a stock ticker use have a long hash id.

I'm planning to use twitter to feed post trades to, and with a character limit of 140 characters it's almost all used up just with the id. Letting twitter keep all trade records but giving users instant updates on the latest trades.

It'll also help users by having shorter strings to work with.

At least I hope it will.
newbie
Activity: 39
Merit: 0
April 14, 2011, 03:18:38 PM
#4
Nefario, check this:

http://blog.logeek.fr/2009/7/2/creating-small-unique-tokens-in-ruby

I found it pretty useful.
administrator
Activity: 5222
Merit: 13032
April 14, 2011, 12:53:47 PM
#3
Also, if you run Bitcoin in debug mode and double click on a txn, it will give you a very short (16 char?) string which BlockExplorer knows what to do with. Theymos might be able to tell you what exactly that string is.

It's the first part the hash. Even with these few characters, collisions are rare.

50 characters is probably overkill. That's more entropy than even Bitcoin addresses. I'd probably use 12-16 bytes of high-quality randomness concatenated with the UTC time of item creation, leaving out the last four digits of the time. Then base58-encode this.

It depends on the situation, though.
sr. member
Activity: 294
Merit: 252
April 14, 2011, 12:27:09 PM
#2
I'm using 512sha2 hashes as an id, however I would like to use a shorter string, what options are there available?

I'm thinking not using all the hash, say the first 50-100 characters to lookup the whole hash and get to work that way.

If there is a collision at say 50characters (2 hash id's have the same first 50 character) then what should I do?

Workable?

Is there a specific term for what I'm attempting to do?

Well, Bitcoin takes the SHA256 hash of the public key and turns it into an address by hashing with RipeMD-160 and then Base58 encoding the result (and some other stuff). Perhaps something like that?

Also, if you run Bitcoin in debug mode and double click on a txn, it will give you a very short (16 char?) string which BlockExplorer knows what to do with. Theymos might be able to tell you what exactly that string is.
hero member
Activity: 602
Merit: 513
GLBSE Support [email protected]
April 14, 2011, 11:51:34 AM
#1
I'm using 512sha2 hashes as an id, however I would like to use a shorter string, what options are there available?

I'm thinking not using all the hash, say the first 50-100 characters to lookup the whole hash and get to work that way.

If there is a collision at say 50characters (2 hash id's have the same first 50 character) then what should I do?

Workable?

Is there a specific term for what I'm attempting to do?
Jump to: