src/Classes/AdldapUtils.php
public function getTextSID($binsid)
    {
        $hex_sid = bin2hex($binsid);

        $rev = hexdec(substr($hex_sid, 0, 2));

        $subcount = hexdec(substr($hex_sid, 2, 2));

        $auth = hexdec(substr($hex_sid, 4, 12));

        $result = "$rev-$auth";

        $subauth = [];

        for ($x = 0;$x < $subcount; $x++) {
            $subauth[$x] = hexdec($this->littleEndian(substr($hex_sid, 16 + ($x * 8), 8)));

            $result .= '-'.$subauth[$x];
        }

        // Cheat by tacking on the S-
        return 'S-'.$result;
    }
public function getTextSID($binsid)
    {
        $hex_sid = bin2hex($binsid);

        $rev = hexdec(substr($hex_sid, 0, 2));

        $subcount = hexdec(substr($hex_sid, 2, 2));

        $auth = hexdec(substr($hex_sid, 4, 12));

        $result = "$rev-$auth";

        $subauth = [];

        for ($x = 0;$x < $subcount; $x++) {
            $subauth[$x] = hexdec($this->littleEndian(substr($hex_sid, 16 + ($x * 8), 8)));

            $result .= '-'.$subauth[$x];
        }

        // Cheat by tacking on the S-
        return 'S-'.$result;
    }
public function getTextSID ( $ binsid ) { $ hex_sid = bin2hex ( $ binsid ) ; $ rev = hexdec ( substr ( $ hex_sid , 0 , 2 ) ) ; $ subcount = hexdec ( substr ( $ hex_sid , 2 , 2 ) ) ; $ auth = hexdec ( substr ( $ hex_sid , 4 , 12 ) ) ; $ result = "$rev-$auth" ; $ subauth = [ ] ; for ( $ x = 0 ; $ x < $ subcount ; $ x ++ ) { $ subauth [ $ x ] = hexdec ( $ this -> littleEndian ( substr ( $ hex_sid , 16 + ( $ x * 8 ) , 8 ) ) ) ; $ result .= '-' . $ subauth [ $ x ] ; } // Cheat by tacking on the S- return 'S-' . $ result ; }
Convert a binary SID to a text SID.

@param string $binsid A Binary SID

@return string
Convert a binary SID to a text SID .