The message maps to a bit x in the message, x = M%(⌊log2(message)⌋+1), inverts the state, x^1, and the bit to the right of x is the new leftmost end of the binary string. This process is repeated n times, where n is =>⌊log2(message)⌋+1.
To easier see the steps in the hash function, think of M as being wrapped into a circle, with the leftmost bit as the start site. This start site shifts similar to turning a vault knob.
import math
import random
message = random.getrandbits(256)
message_length = int(math.log(message, 2))+1
n = 1
for i in range(n*message_length):
x = message%message_length
message = message<<message_length-x & (1 << message_length) - 1 | message>>x ^1