import zlib x = zlib.crc32('banana stand') & 0xffffffff y = x binary = bin(x) y = y >> binary.count('1') print y