# EncodingService

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Not replicated, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/EncodingService/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/EncodingService

Service providing common encoding, hashing, and compression methods.

## Methods

### Base64Decode

```luau
EncodingService:Base64Decode(input: buffer): buffer
```

- Tags: Thread safe

Decodes a Base64-encoded buffer into a new buffer containing the original binary data.

Parameters:

- `input`: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) containing Base64 data to decode

Returns: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with the decoded result

### Base64Encode

```luau
EncodingService:Base64Encode(input: buffer): buffer
```

- Tags: Thread safe

Encodes binary data from a buffer into Base64 format, returning the result as a new buffer.

Parameters:

- `input`: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) containing binary data to encode

Returns: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with the encoded result

### CompressBuffer

```luau
EncodingService:CompressBuffer(input: buffer, algorithm: Enum.CompressionAlgorithm, compressionLevel: number? = 1): buffer
```

- Tags: Thread safe

Compresses binary buffer data using the specified algorithm and compression level.

Parameters:

- `input`: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with binary data to compress
- `algorithm`: `CompressionAlgorithm` to use for compression
- `compressionLevel`: optional integer compression level to use

Returns: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with compressed binary data

### ComputeBufferHash

```luau
EncodingService:ComputeBufferHash(input: buffer, algorithm: Enum.HashAlgorithm): buffer
```

- Tags: Thread safe

Computes a cryptographic hash of a buffer's binary data using the specified algorithm.

Parameters:

- `input`: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with binary data to compute hash for
- `algorithm`: `HashAlgorithm` cryptographic hash function

Returns: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with the binary data of the hash

### ComputeStringHash

```luau
EncodingService:ComputeStringHash(input: string, algorithm: Enum.HashAlgorithm): string
```

- Tags: Thread safe

Computes a cryptographic hash of a string using the specified algorithm.

Parameters:

- `input`: string to compute the hash for
- `algorithm`: `HashAlgorithm` cryptographic hash function

Returns: String with the binary data of the hash

### DecompressBuffer

```luau
EncodingService:DecompressBuffer(input: buffer, algorithm: Enum.CompressionAlgorithm): buffer
```

- Tags: Thread safe

Decompresses binary buffer data that was compressed with the specified algorithm.

Parameters:

- `input`: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with compressed binary data
- `algorithm`: `CompressionAlgorithm` to use for decompression

Returns: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with the decompressed binary data

### GetDecompressedBufferSize

```luau
EncodingService:GetDecompressedBufferSize(input: buffer, algorithm: Enum.CompressionAlgorithm): number?
```

- Tags: Thread safe

Returns the expected decompressed size of a compressed buffer, or nil if the size is unknown or invalid.

Parameters:

- `input`: [`buffer`](https://rapi.sleaze.dev/index/types/buffer.md) with compressed binary data
- `algorithm`: `CompressionAlgorithm` used to compress it

Returns: Integer size of the decompressed data or 'nil'

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
