How does the btc.to address shortening algorithm work? Is is a deterministic algorithm, that is, it can be reproduced on other websites with the same results, or are the results specific to the website and the order in which the addresses were inputted?
-
1this might actually be more appropriate on StackOverflow, as it isn't actually a bitcoin specific piece (cf twitter's t.co, and stackexchange's own shortened URL's)– Rory AlsopCommented Jan 12, 2012 at 11:30
-
3@RoryAlsop: I'd say it's pretty Bitcoin specific since it is a way to shorten Bitcoin addresses, not a general service for web addresses or so. Do you agree?– D.H.Commented Jan 12, 2012 at 11:54
-
2@RoryAlsop I believe this question is on-topic, as it deals with a website specific to Bitcoins. Whether their algorithm relies on Bitcoin-related data or not is (at least to me), unknown, thus only by answering this question we can know if any further topics related to btc.co would be on, or off topic.– ThePiachuCommented Jan 12, 2012 at 12:00
-
that makes sense - I was thinking it was the more general case.– Rory AlsopCommented Jan 12, 2012 at 12:22
1 Answer
The results are specific to the website and the order in which the addresses were input.
This can be easily determined by experiment. I took a random address from BE and it gave me http://btc.to/2z7. I took another address and it gave me http://btc.to/2z8.
So clearly, it stores all given addresses in a database, and the URL is the address ID encoded in base 36 (experiment also shows that it's case insensitive).
Also, it only accepts valid Bitcoin addresses.
More generally, it's impossible for any algorithm to take an arbitrary long, high-entropy string and give a short string which can be uniquely mapped back to the input.
-
As for the last part, you can still create an algorithm that shortens some of those high-entropy strings, especially if you have some additional information about them (like FirstBits did). Commented Jan 12, 2012 at 17:10
-
2Firstbits makes use of the fact that the address already appears in the block chain, which means that it is not high-entropy (or that it is not arbitrary, depending on how you look at it). Commented Jan 12, 2012 at 17:23