Binary Functions

Use the binary functions to operate on binary data.

FunctionReturn TypeInput ArgumentsDescription
concat(b1, b2, ...)Varbinary
  • b1, b2, ...: Binaries
Returns the concatenation of the input arguments.
crc32(b)Bigint
  • b: Binary
Returns the CRC-32 checksum of the input binary.
from_base64(s)Binary
  • s: String
Returns binary data from the base64 encoded input string.
from_base64url(s)Binary
  • s: String
Returns binary data from the base64 encoded input string using the URL safe alphabet.
from_big_endian_32(b)Integer
  • b: Binary
Returns the 32-bit two's complement big-endian binary. The input must be exactly four bytes.
from_big_endian_64(b)Bigint
  • b: Binary
Returns the 64-bit two's complement big-endian binary. The input must be exactly eight bytes.
from_hex(s)Binary
  • s: String
Returns binary data from hex encoded input string.
from_ieee754_32(b)Real
  • b: Binary
Returns the 32-bit big-endian binary in IEEE 754 single-precision floating-point format. The input must be exactly four bytes.
from_ieee754_64(b)Double
  • b: Binary
Returns the 64-bit big-endian binary in IEEE 754 double-precision floating-point format. The input must be exactly eight bytes.
hmac_md5(b, key)Varbinary
  • b: Binary
  • key: Integer
Returns the MD5 HMAC of the input binary with the given key.
hmac_sha1(b, key)Varbinary
  • b: Binary
  • key: Integer
Returns the SHA1 HMAC of the input binary with the given key.
hmac_sha256(b, key)Varbinary
  • b: Binary
  • key: Integer
Returns the SHA256 HMAC of the input binary with the given key.
hmac_sha512(b, key)Varbinary
  • b: Binary
  • key: Integer
Returns the SHA512 HMAC of the input binary with the given key.
length(b)Bigint
  • b: Binary
Returns the length of binary in bytes.
lpad(b, size, padbinary)Varbinary
  • b: Binary
  • size: Integer
  • padbinary: Binary
Left pads the input binary to size bytes with padbinary. If size is less than the length of b, the result is truncated to size characters. size must not be negative and padbinary must be non-empty.
md5(b)Varbinary
  • b: Binary
Returns the MD5 of the input.
murmur3(b)Varbinary
  • b: Binary
Returns the 128-bit MurmurHash3 of the input.
reverse(b)Varbinary
  • b: Binary
Returns b with the bytes in reverse order.
rpad(b, size, padbinary)Varbinary
  • b: Binary
  • size: Number
  • padbinary: Binary
Right pads the input binary to size bytes with padbinary. If size is less than the length of b, the result is truncated to size characters. size must not be negative and padbinary must be non-empty.
sha1(b)Varbinary
  • b: Binary
Returns the SHA1 hash of the input.
sha256(b)Varbinary
  • b: Binary
Returns the SHA256 of the input.
sha512(b)Varbinary
  • b: Binary
Returns the SHA512 hash of the input.
spooky_hash_v2_32(b)Varbinary
  • b: Binary
Returns the 32-bit SpookyHashV2 hash of the input.
spooky_hash_v2_64(b)Varbinary
  • b: Binary
Returns the 64-bit SpookyHashV2 hash of the input.
substr(b, start)Varbinary
  • b: Binary
  • start: Number
Returns the end of the input binary from the starting position start, measured in bytes. Positions start with 1. A negative starting position is interpreted as being relative to the end of the string.
to_base64(b)Varchar
  • b: Binary
Encodes the input into a base64 string representation.
to_base64url(b)Varchar
  • b: Binary
Encodes the input into a base64 string representation using the URL safe alphabet.
to_big_endian_32(n)Varbinary
  • n: Integer
Encodes the input into a 32-bit two's complement big-endian format.
to_big_endian_64(n)Varbinary
  • n: Bigint
Encodes the input into a 64-bit two's complement big-endian format.
to_hex(b)Varchar
  • b: Binary
Encodes the input into a hex string representation.
to_ieee754_32(r)Varbinary
  • r: Real
Encodes the input into a 32-bit big-endian binary according to IEEE 754 single-precision floating-point format.
to_ieee754_64(d)Varbinary
  • d: Double
Encodes the input into a 64-bit big-endian binary according to IEEE 754 double-precision floating-point format.
xxhash64(b)Varbinary
  • b: Binary
Returns the xxHash64 hash of the input.