Bitcoin Forum
December 08, 2016, 10:11:38 PM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: shortening hashes as a shortcut  (Read 914 times)
Nefario
Hero Member
*****
Offline Offline

Activity: 602


GLBSE Support support@glbse.com


View Profile WWW
April 14, 2011, 04:51:34 PM
 #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?

PGP key id at pgp.mit.edu 0xA68F4B7C

To get help and support for GLBSE please email support@glbse.com
1481235099
Hero Member
*
Offline Offline

Posts: 1481235099

View Profile Personal Message (Offline)

Ignore
1481235099
Reply with quote  #2

1481235099
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481235099
Hero Member
*
Offline Offline

Posts: 1481235099

View Profile Personal Message (Offline)

Ignore
1481235099
Reply with quote  #2

1481235099
Report to moderator
1481235099
Hero Member
*
Offline Offline

Posts: 1481235099

View Profile Personal Message (Offline)

Ignore
1481235099
Reply with quote  #2

1481235099
Report to moderator
1481235099
Hero Member
*
Offline Offline

Posts: 1481235099

View Profile Personal Message (Offline)

Ignore
1481235099
Reply with quote  #2

1481235099
Report to moderator
BitterTea
Sr. Member
****
Offline Offline

Activity: 294



View Profile
April 14, 2011, 05: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.
theymos
Administrator
Legendary
*
expert
Offline Offline

Activity: 2506


View Profile
April 14, 2011, 05: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.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
yomi
Jr. Member
*
Offline Offline

Activity: 40


View Profile
April 14, 2011, 08: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.

17qXiw646kuukEwjArHNKCNPUh3HnXfgbw
Nefario
Hero Member
*****
Offline Offline

Activity: 602


GLBSE Support support@glbse.com


View Profile WWW
April 15, 2011, 01:58:08 AM
 #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.

PGP key id at pgp.mit.edu 0xA68F4B7C

To get help and support for GLBSE please email support@glbse.com
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!