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
|
||||
# :Author:Shin Adachi <shn@glucose.jp>
|
||||
# Licesensed under FreeBSD License.
|
||||
# import identicon
|
||||
import identicon
|
||||
# usage: identicon.render_identicon(code, size)
|
||||
# requires PIL
|
||||
|
||||
|
@ -75,27 +75,25 @@ def identiconize(address):
|
|||
idcon = QtGui.QIcon()
|
||||
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]'
|
||||
if address == str_broadcast_subscribers:
|
||||
idcon = QtGui.QIcon(":/newPrefix/images/can-icon-24px.png")
|
||||
return idcon
|
||||
|
||||
# PHP-like code
|
||||
suffix = "asdf"
|
||||
# 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
|
||||
|
||||
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()
|
||||
|
||||
|
|
Reference in New Issue
Block a user