now it should also work with the other identicon file
This commit is contained in:
parent
9b28e1932d
commit
a9fb87173f
|
@ -53,7 +53,7 @@ import hashlib
|
||||||
# load identicon code
|
# load identicon code
|
||||||
# :Author:Shin Adachi <shn@glucose.jp>
|
# :Author:Shin Adachi <shn@glucose.jp>
|
||||||
# Licesensed under FreeBSD License.
|
# Licesensed under FreeBSD License.
|
||||||
# import identicon
|
import identicon
|
||||||
# usage: identicon.render_identicon(code, size)
|
# usage: identicon.render_identicon(code, size)
|
||||||
# requires PIL
|
# requires PIL
|
||||||
|
|
||||||
|
@ -75,29 +75,27 @@ def identiconize(address):
|
||||||
idcon = QtGui.QIcon()
|
idcon = QtGui.QIcon()
|
||||||
return idcon
|
return idcon
|
||||||
|
|
||||||
suffix = "" # here you could put "@bitmessge.ch" or "@bm.addr" to make it compatible with other identicon generators
|
|
||||||
# instead, you could also use a pseudo-password to salt the generation of the identicons
|
|
||||||
# Attacks where someone creates an address to mimic someone else's identicon should be impossible then
|
|
||||||
# i think it should generate a random string by default
|
|
||||||
|
|
||||||
# hash = hashlib.md5(addBMIfNotPresent(address)+suffix).hexdigest()[:8]
|
|
||||||
# print hash
|
|
||||||
##japanese code
|
|
||||||
# idcon_render = identicon.render_identicon(int(hash, 16), 8)
|
|
||||||
# idcon_render.save('images/'+hash+'.png')
|
|
||||||
# im = idcon_render
|
|
||||||
# http://qt-project.org/forums/viewthread/5866
|
|
||||||
# from PIL import Image
|
|
||||||
# from PyQt4.QtGui import QImage, QImageReader, QLabel, QPixmap, QApplication
|
|
||||||
|
|
||||||
str_broadcast_subscribers = '[Broadcast subscribers]'
|
str_broadcast_subscribers = '[Broadcast subscribers]'
|
||||||
if address == str_broadcast_subscribers:
|
if address == str_broadcast_subscribers:
|
||||||
idcon = QtGui.QIcon(":/newPrefix/images/can-icon-24px.png")
|
idcon = QtGui.QIcon(":/newPrefix/images/can-icon-24px.png")
|
||||||
return idcon
|
return idcon
|
||||||
|
|
||||||
# PHP-like code
|
suffix = "asdf"
|
||||||
idcon_render = Pydenticon(addBMIfNotPresent(address)+suffix)
|
# here you could put "@bitmessge.ch" or "@bm.addr" to make it compatible with other identicon generators
|
||||||
image = idcon_render._render()
|
# instead, you could also use a pseudo-password to salt the generation of the identicons
|
||||||
|
# Attacks where someone creates an address to mimic someone else's identicon should be impossible then
|
||||||
|
# i think it should generate a random string by default
|
||||||
|
|
||||||
|
if True: # identicon.py
|
||||||
|
hash = hashlib.md5(addBMIfNotPresent(address)+suffix).hexdigest()
|
||||||
|
idcon_render = identicon.render_identicon(int(hash, 16), 48)
|
||||||
|
image = idcon_render
|
||||||
|
# http://qt-project.org/forums/viewthread/5866
|
||||||
|
# from PIL import Image
|
||||||
|
# from PyQt4.QtGui import QImage, QImageReader, QLabel, QPixmap, QApplication
|
||||||
|
else: # pydenticon.py
|
||||||
|
idcon_render = Pydenticon(addBMIfNotPresent(address)+suffix)
|
||||||
|
image = idcon_render._render()
|
||||||
|
|
||||||
# im = Image.open('images/'+hash+'.png')
|
# im = Image.open('images/'+hash+'.png')
|
||||||
# http://stackoverflow.com/questions/6756820/python-pil-image-tostring
|
# http://stackoverflow.com/questions/6756820/python-pil-image-tostring
|
||||||
|
|
Loading…
Reference in New Issue
Block a user