Lines Matching defs:data
18 * Helper functions to decode a SASL buffer when a security layer is installed. These can be used when receiving data
19 * over the wire with a SASL security layer to determine whether or not the buffer is complete, and then unwrap the data.
26 * Wraps the buffer by pre-pending the data length.
28 public static function wrap(string $data): string
30 return pack('N1', strlen($data)) . $data;
34 * Unwrap the buffer by removing pre-pended length and verifying we have enough data. Only the data is returned.
39 public static function unwrap(string $data): string
41 $length = strlen($data);
43 throw new SaslBufferException('Not enough data to unwrap the SASL buffer.');
46 $bufferLength = hexdec(bin2hex(substr($data, 0, 4)));
54 return substr($data, 4, $bufferLength);