Staging
v0.8.1
https://github.com/python/cpython
Revision 8907dcd3fff6211afd57f571dc7ff985f2937717 authored by Gregory P. Smith on 12 June 2016, 00:56:12 UTC, committed by Gregory P. Smith on 12 June 2016, 00:56:12 UTC
document that md5 may be missing in the rare case someone is using a
"FIPS compliant" build.  I've only ever heard of Redhat creating one
of those - CPython itself offers no such build mode out of the box.
1 parent 6a7506a
Raw File
Tip revision: 8907dcd3fff6211afd57f571dc7ff985f2937717 authored by Gregory P. Smith on 12 June 2016, 00:56:12 UTC
issue15468 - use sha256 instead of md5 or sha1 in the examples.
Tip revision: 8907dcd
antigravity.py

import webbrowser
import hashlib

webbrowser.open("http://xkcd.com/353/")

def geohash(latitude, longitude, datedow):
    '''Compute geohash() using the Munroe algorithm.

    >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
    37.857713 -122.544543

    '''
    # http://xkcd.com/426/
    h = hashlib.md5(datedow).hexdigest()
    p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
    print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))
back to top