mirror of
https://github.com/e1ven/Robohash.git
synced 2025-06-23 21:35:02 +00:00
md5bits
This commit is contained in:
parent
8ac947a94a
commit
ee805ff642
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
21
tests/md5bits.py
Normal file
21
tests/md5bits.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import hashlib
|
||||||
|
import pprint
|
||||||
|
|
||||||
|
numblocks = 5
|
||||||
|
blockcount = 10
|
||||||
|
|
||||||
|
hash = hashlib.sha512()
|
||||||
|
hash.update("This is my not-yethashed text")
|
||||||
|
hexdigest = hash.hexdigest()
|
||||||
|
|
||||||
|
hashes = []
|
||||||
|
for i in range(0,numblocks):
|
||||||
|
#Get 1/numblocks of the hash
|
||||||
|
blocksize = (len(hexdigest) / numblocks)
|
||||||
|
currentstart = (1 + i) * blocksize - blocksize
|
||||||
|
currentend = (1 +i) * blocksize
|
||||||
|
hashes.append(int(hash.hexdigest()[currentstart:currentend],16))
|
||||||
|
|
||||||
|
pprint.pprint(hashes)
|
||||||
|
for h in hashes:
|
||||||
|
print h % 10
|
@ -51,7 +51,7 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
for png in hashlist:
|
for png in hashlist:
|
||||||
img = Image.open(png)
|
img = Image.open(png)
|
||||||
robohash.paste(img,(0,0),img)
|
robohash.paste(img,(0,0),img)
|
||||||
robohash.save("/opt/robohash/static/images/out.png")
|
robohash.save("static/images/out.png")
|
||||||
self.write("Running in Random mode:<br>")
|
self.write("Running in Random mode:<br>")
|
||||||
self.write("<img src='/images/out.png'>")
|
self.write("<img src='/images/out.png'>")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user