Created
January 31, 2014 01:08
-
-
Save kylelk/8724766 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hashlib import sha512 | |
import Image | |
import numpy as np | |
def chunks(l, n): | |
return [l[i:i+n] for i in range(0, len(l), n)] | |
word_list = open("words.txt", "r").read().split() | |
for word in word_list: | |
data_string = "hello world" | |
hash = sha512(data_string).digest() | |
hash_array = chunks(hash, 2) | |
output = [] | |
w,h = 256, 256 | |
data = np.zeros( (w,h,3), dtype=np.uint8) | |
for item in hash_array: | |
#output.append([ord(item[0]), ord(item[1])]+[0]) | |
data[ord(item[0]), ord(item[1])] = [255,255,255] | |
img = Image.fromarray(data, 'RGB') | |
print data | |
img.save('my.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment