Garry's Mod Wiki

util.Base64Encode

  string util.Base64Encode( string str, boolean inline = false )

Description

Encodes the specified string to base64.

Unless disabled with the inline argument, the Base64 returned is compliant to the RFC 2045 standard. This means it will have a line break after every 76th character.

Arguments

1 string str
String to encode.
2 boolean inline = false
true to disable RFC 2045 compliance (newline every 76th character)

Returns

1 string
Base 64 encoded string.

Example

Encodes a string

local encoded = util.Base64Encode( "Base64 Encoding" ) print(encoded)
Output: QmFzZTY0IEVuY29kaW5n