> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# crypt.generatebytes

> Tao byte ngau nhien bang random byte generator va tra ve chung Base64-encoded duoi dang Lua string.

<div className="real-function-page">
  ```lua theme={null}
  crypt.generatebytes(size: number): string
  ```

  ## Đối số

  <ParamField path={"size"} type={"number"} required>
    So duoc dua qua integer conversion truoc khi allocation. Cac gia tri nho hon hoac bang 0 duoc doi thanh 1.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"encoded"} type={"string"}>
    Base64 encoding cua raw bytes da tao. Do dai string duoc tra ve khong phai so byte da yeu cau.
  </ResponseField>

  ## Ví dụ

  Tao bytes va decode ket qua Base64 khi can raw bytes.

  ```lua theme={null}
  local encoded = crypt.generatebytes(16)
  local raw = base64_decode(encoded)

  print(encoded)
  print(#encoded)
  print(#raw)
  ```
</div>
