Difference between revisions of "The Algorithm"
From Geohashing
imported>Tjtrumpet2323 m |
imported>Tjtrumpet2323 |
||
Line 3: | Line 3: | ||
'''This time, we ''did'' invent the algorithm!''' | '''This time, we ''did'' invent the algorithm!''' | ||
− | * The current date (in yyyy-mm-dd format) and the daily opening price of the [[Dow Jones Industrial Average]] are concatenated with a hyphen | + | * The current date (in yyyy-mm-dd format) and the daily opening price of the [[Dow Jones Industrial Average]] are concatenated with a hyphen |
** If there is no opening price for the Dow, the opening price from its previous day of active trading is used instead. | ** If there is no opening price for the Dow, the opening price from its previous day of active trading is used instead. | ||
− | * The resulting string is split into two halves of 16 hexadecimal digits. | + | * The resulting string is then fed through the well-known [[wikipedia:MD5|MD5]] cryptographic algorithm to generate as pseudo-random "hash" of 32 hexadecimal digits. |
− | * Each half | + | * The "hash" is then split into two halves of 16 hexadecimal digits. |
− | * The resulting decimal fractions are appended to the integral (lat,lon) values of any given [[graticule]] to produce that graticule's geohash target. | + | * Each half of the "hash" is prepended with a decimal point (so as to represent a hexadecimal fraction) and is converted to a base-10 fraction. |
+ | * The resulting decimal fractions are appended to the integral (lat,lon) values of any given [[graticule]] to produce that graticule's geohash target for the day. | ||
== Fractional hexadecimal to decimal calculation == | == Fractional hexadecimal to decimal calculation == | ||
Many online hex-to-dec converters do not support hexadecimal fractions. Here is one that does: | Many online hex-to-dec converters do not support hexadecimal fractions. Here is one that does: | ||
* [http://www.easysurf.cc/cnver17.htm#bf16tobf10 EasySurf.cc] | * [http://www.easysurf.cc/cnver17.htm#bf16tobf10 EasySurf.cc] |
Revision as of 22:36, 23 May 2008
This time, we did invent the algorithm!
- The current date (in yyyy-mm-dd format) and the daily opening price of the Dow Jones Industrial Average are concatenated with a hyphen
- If there is no opening price for the Dow, the opening price from its previous day of active trading is used instead.
- The resulting string is then fed through the well-known MD5 cryptographic algorithm to generate as pseudo-random "hash" of 32 hexadecimal digits.
- The "hash" is then split into two halves of 16 hexadecimal digits.
- Each half of the "hash" is prepended with a decimal point (so as to represent a hexadecimal fraction) and is converted to a base-10 fraction.
- The resulting decimal fractions are appended to the integral (lat,lon) values of any given graticule to produce that graticule's geohash target for the day.
Fractional hexadecimal to decimal calculation
Many online hex-to-dec converters do not support hexadecimal fractions. Here is one that does: