All pastes #1875103 Raw Edit

Something

public python v1 · immutable
#1875103 ·published 2010-05-31 22:58 UTC
rendered paste body
#!/usr/bin/pythonimport hashlibf="/home/agagag/media/images/dentro2.jpg"s=open(f)source=s.read()m = hashlib.md5()m.update(source)m.update(source)raw=m.digest()dgst_raw=bytearray(raw)print "hexdigest of input file %s : %s "  % (f, m.hexdigest(),)print "length in bytes : %d"  % m.digest_size# FLDBASE got to be even FLDBASE=8FLDSIZE_Y=(FLDBASE + 1)FLDSIZE_X=(FLDBASE * 2 + 1)augmentation_string = " .o+=*BOX@%&#/^SE"dgst_size=m.digest_size# create a 2d array and fill it up with dotsfield = [['.' for x in range(FLDSIZE_X)] for y in range(FLDSIZE_Y)]length=len(augmentation_string)-1# we start in the center.x = FLDSIZE_X / 2y = FLDSIZE_Y / 2field[y][x]='x'print "Initial value of x %d" % xprint "Initial value of y %d" % y# process raw keyfor i in range(0,dgst_size):    mybyte= dgst_raw[i]        if  mybyte > 128:        y+=1        x+=1        field[y][x]='>'        print 'x', x,        if x==0 or y==0:            x = max(x, 0)            y = max(y, 0)        else:            if x > FLDSIZE_X-1 or y > FLDSIZE_Y-1:                x = min(x, FLDSIZE_X - 1)                y = min(y, FLDSIZE_Y - 1)    else:        if mybyte < 128:            x-=1            y-=1             field[y][x]='<'            print 'y', y,#print rowsfor row in field:    print "".join(row)