'Creates the identicon.
First three bytes are used to generate the color,
remaining bytes are used to create the drawing'

def calculate(self):

    color = random.choice(((254, 196, 197), (253, 138, 139), (254, 231, 206), (254, 208, 159), (210, 211, 253), (163, 165, 252), (247, 213, 247), (242, 172, 238), (235, 247, 206), (217, 241, 157), (211, 248, 237), (167, 242, 221), (255, 249, 207), (254, 245, 161), (211, 241, 254), (168, 228, 254), (207, 245, 210), (159, 235, 164)))
    self.hash >>= 24
    square_x = square_y = 0
    for x in range(((GRID_SIZE * (GRID_SIZE + 1)) // 2)):
        if (self.hash & 1):
            x = (BORDER_SIZE + (square_x * SQUARE_SIZE))
            y = (BORDER_SIZE + (square_y * SQUARE_SIZE))
            self.draw.rectangle((x, y, (x + SQUARE_SIZE), (y + SQUARE_SIZE)), fill=color, outline=color)
            x = (BORDER_SIZE + (((GRID_SIZE - 1) - square_x) * SQUARE_SIZE))
            self.draw.rectangle((x, y, (x + SQUARE_SIZE), (y + SQUARE_SIZE)), fill=color, outline=color)
        self.hash >>= 1
        square_y += 1
        if (square_y == GRID_SIZE):
            square_y = 0
            square_x += 1
