You can use decimal to binary if security is not the issue.
//86 to 8 bit binary $bin = decbin(86) $bin = substr("00000000",0,8 - strlen($bin)) . $bin; echo $bin; //01010110 //$bin to dec i.e 86 echo bindec($bin); //86
as also can use any of your own formula to convert.
you can use PHP hash