private function getBinaryMask($mask) {
        // Prefix the string
        $hexMask = str_repeat('f', $mask / 4);

        // Add the remainder
        switch ($mask % 4) {
            case 1:
                $hexMask .= '8';
                break;
            case 2:
                $hexMask .= 'c';
                break;
            case 3:
                $hexMask .= 'e';
                break;
        }

        // Pad with 0 to 32 in length
        $hexMask = str_pad($hexMask, 32, '0');

        // Pack into binary string
        return hex2bin($hexMask);
    }