#Mathematica, 89 bytes
    Last@CellularAutomaton[(a=Mod)[#^2,256],{#~IntegerDigits~2,0},{#~a~99,128}]~FromDigits~2&
Not the shortest, but I would be surprised if this was cracked.