Lines Matching refs:bytes

187                 $bytes = $type->getValue() ? self::BOOL_TRUE : self::BOOL_FALSE;
191 $bytes = $this->encodeInteger($type);
194 $bytes = $this->encodeReal($type);
197 $bytes = $type->getValue();
200 $bytes = $this->encodeSetOf($type);
203 $bytes = $this->encodeSet($type);
206 $bytes = $this->encodeConstructedType(...$type->getChildren());
209 $bytes = $this->encodeBitString($type);
212 $bytes = $this->encodeOid($type);
215 $bytes = $this->encodeRelativeOid($type);
218 $bytes = $this->encodeGeneralizedTime($type);
221 $bytes = $this->encodeUtcTime($type);
224 $bytes = '';
232 $length = strlen($bytes);
233 $bytes = ($length < 128) ? chr($length) . $bytes : $this->encodeLongDefiniteLength($length) . $bytes;
239 # For a high tag (>=31) we flip the first 5 bits on (0x1f) to make the first byte, then the subsequent bytes is
242 $bytes = chr($tag | 0x1f) . $this->intToVlqBytes($type->getTagNumber()) . $bytes;
245 $bytes = chr($tag | $type->getTagNumber()) . $bytes;
248 return $bytes;
338 # A high tag number is determined using VLQ (like the OID identifier encoding) of the subsequent bytes.
346 'Not enough data to decode the high tag number. No ending byte encountered for the VLQ bytes.'
516 # The length of the length bytes is in the first 7 bits. So remove the MSB to get the value.
521 throw new EncoderException('The decoded length cannot be equal to 127 bytes.');
538 * Given what should be VLQ bytes represent an int, get the int and the length of bytes.
581 * Get the bytes that represent variable length quantity.
594 $bytes = chr(gmp_intval(gmp_and(gmp_init(0x7f), $int)));
598 $bytes = chr(0x7f & $int);
605 $bytes = chr(gmp_intval(gmp_or(gmp_and(gmp_init(0x7f), $int), gmp_init(0x80)))) . $bytes;
609 $bytes = chr((0x7f & $int) | 0x80) . $bytes;
615 return $bytes;
644 $bytes = '';
646 $bytes = (chr((int) ($num % 256))) . $bytes;
650 $length = strlen($bytes);
652 throw new EncoderException('The encoded length cannot be greater than or equal to 127 bytes');
655 return chr(0x80 | $length) . $bytes;
673 $bytes = chr($unused);
675 $bytes .= chr(bindec(substr($data, $i * 8, 8)));
678 return $bytes;
690 $bytes = '';
692 $bytes .= $this->intToVlqBytes($oid);
695 return $bytes;
728 $bytes = $this->intToVlqBytes($firstAndSecond);
731 $bytes .= $this->intToVlqBytes($oids[$i]);
734 return $bytes;
838 $bytes = gmp_export($int);
842 $bytes = hex2bin((strlen($hex) % 2) === 0 ? $hex : '0' . $hex);
847 $len = strlen($bytes);
849 /** @var string $bytes */
850 $bytes[$i] = ~$bytes[$i];
855 $msbSet = (bool) (ord($bytes[0]) & 0x80);
857 $bytes = self::BOOL_FALSE . $bytes;
859 $bytes = self::BOOL_TRUE . $bytes;
862 return $bytes;
921 $bytes = substr($this->binary, $this->pos, $length);
923 if (!preg_match($regex, $bytes, $matches)) {
954 $dateTime = DateTime::createFromFormat($format, $bytes);
958 $bytes = null;
1092 $bytes = substr($this->binary, $this->pos, $length);
1095 $isNegative = (ord($bytes[0]) & 0x80);
1099 $bytes[$i] = ~$bytes[$i];
1102 $int = hexdec(bin2hex($bytes));
1107 $int = gmp_import($bytes);
1109 $bytes = null;
1187 $bytes = '';
1190 $bytes .= $this->encode($type);
1193 return $bytes;