# This file is automatically generated. Please don't edit it manually. # To submit a bug report on the content, see # https://devforum.roblox.com/c/bug-reports/documentation-issues/72 name: EncodingService type: class memory_category: Instances summary: | Service providing common encoding, hashing, and compression methods. description: | Service providing common encoding, hashing, and compression methods. code_samples: [] inherits: - Instance descendants: [] tags: - NotCreatable - Service - NotReplicated deprecation_message: '' properties: [] methods: - name: EncodingService:Base64Decode summary: '' description: | Method takes a `Library.buffer` with data encoded in Base64 format and decodes it into a new `Library.buffer`. If the input is not valid Base64 data, this method throws an error. Base64 data is most often used for binary data encoding, so these functions are designed to work on `Library.buffer` values. If the data is stored in a string, `Library.buffer.fromstring` can be used to quickly convert it into a buffer. code_samples: [] parameters: - name: input type: buffer default: summary: | `Library.buffer` containing Base64 data to decode returns: - type: buffer summary: | `Library.buffer` with the decoded result tags: [] deprecation_message: '' security: None thread_safety: Safe capabilities: [] - name: EncodingService:Base64Encode summary: '' description: | Method takes a `Library.buffer` with binary data and encodes it using Base64. Encoded result is returned as a new `Library.buffer`. code_samples: [] parameters: - name: input type: buffer default: summary: | `Library.buffer` containing binary data to encode returns: - type: buffer summary: | `Library.buffer` with the encoded result tags: [] deprecation_message: '' security: None thread_safety: Safe capabilities: [] - name: EncodingService:CompressBuffer summary: '' description: | Compresses the binary data stored in a `Library.buffer` using the specified compression algorithm and compression level. The higher the compression level, the longer it takes to compress, but the resulting compression ratio might increase. For `Enum.CompressionAlgorithm.Zstd`, the allowed compression values are from -7 to 22 inclusive. code_samples: [] parameters: - name: input type: buffer default: summary: | `Library.buffer` with binary data to compress - name: algorithm type: CompressionAlgorithm default: summary: | `Enum.CompressionAlgorithm` to use for compression - name: compressionLevel type: int default: 1 summary: | optional integer compression level to use returns: - type: buffer summary: | `Library.buffer` with compressed binary data tags: [] deprecation_message: '' security: None thread_safety: Safe capabilities: [] - name: EncodingService:ComputeBufferHash summary: '' description: | Uses a [cryptographic hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function) to compute a hash of the input `Library.buffer`. Returns a new `Library.buffer` with the binary data. See descriptions of `Enum.HashAlgorithm` to learn of the supported digest size for each hash. #### Do not use this for passwords None of these hashes are password hashing algorithms. They were designed to be fast to execute, whereas password hashing should never be fast. You shouldn't use this function for computing password hashes that will be stored, or for deriving keys from passwords. code_samples: [] parameters: - name: input type: buffer default: summary: | `Library.buffer` with binary data to compute hash for - name: algorithm type: HashAlgorithm default: summary: | `Enum.HashAlgorithm` cryptographic hash function returns: - type: buffer summary: | `Library.buffer` with the binary data of the hash tags: [] deprecation_message: '' security: None thread_safety: Safe capabilities: [] - name: EncodingService:ComputeStringHash summary: '' description: | Uses a [cryptographic hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function) to compute a hash of the input string. Returns a new string with the binary data. See descriptions of `Enum.HashAlgorithm` to learn of the supported digest size for each hash. #### Do not use this for passwords None of these hashes are password hashing algorithms. They were designed to be fast to execute, whereas password hashing should never be fast. You shouldn't use this function for computing password hashes that will be stored, or for deriving keys from passwords. code_samples: [] parameters: - name: input type: string default: summary: | string to compute the hash for - name: algorithm type: HashAlgorithm default: summary: | `Enum.HashAlgorithm` cryptographic hash function returns: - type: string summary: | String with the binary data of the hash tags: [] deprecation_message: '' security: None thread_safety: Safe capabilities: [] - name: EncodingService:DecompressBuffer summary: '' description: | Decompresses the binary data stored in a `Library.buffer` using the specified compression algorithm. Decompression might throw an error if the compressed data doesn't contain expected decompressed size, if it is larger than 1GB or if it is invalid. It is recommended to use `Class.EncodingService.GetDecompressedBufferSize` to find out the decompressed data size before attempting to decompress. This is very important if the input buffer contents are outside of your control (for example, from a client `Class.RemoveEvent`) code_samples: [] parameters: - name: input type: buffer default: summary: | `Library.buffer` with compressed binary data - name: algorithm type: CompressionAlgorithm default: summary: | `Enum.CompressionAlgorithm` to use for decompression returns: - type: buffer summary: | `Library.buffer` with the decompressed binary data tags: [] deprecation_message: '' security: None thread_safety: Safe capabilities: [] - name: EncodingService:GetDecompressedBufferSize summary: '' description: | Reports the size of the decompressed data stored in a compressed `Library.buffer`. If the compressed data doesn't have a size or the size is corrupted or invalid (larger than 1GB), function returns `nil`. When a `nil` is returned, attempting to use `Class.EncodingService.DecompressBuffer` on this `Library.buffer` will throw an error. code_samples: [] parameters: - name: input type: buffer default: summary: | `Library.buffer` with compressed binary data - name: algorithm type: CompressionAlgorithm default: summary: | `Enum.CompressionAlgorithm` used to compress it returns: - type: int? summary: | Integer size of the decompressed data or 'nil' tags: [] deprecation_message: '' security: None thread_safety: Safe capabilities: [] events: [] callbacks: []