wiki.sine.space | sinespace

Scripting/SString

From wiki.sine.space
Revision as of 23:27, 16 February 2017 by Ashasekayi (Talk | contribs)

Jump to: navigation, search

The SHost class represents the scripting runtime.

Members

MD5

string MD5 (string input);

Calculates the MD5Sum of input and returns the result as a hexadecimal string

local inputString = "An input string with data to hash."
local md5Hash = Space.String.MD5(inputString)
Space.Log(md5Hash)
-- prints "304f8dd8835d5fbd159299f7d07653fd")


Base64Encode

string Base64Encode (string input);

Converts input to Base64 and returns the result

local inputString = "input to encode"
local baseEncodeStr = Space.String.Base64Encode(inputString)
Space.Log(baseEncodeStr)
-- prints "aW5wdXQgdG8gZW5jb2Rl"


Base64Encode

string Base64Encode (byte[] input);

Converts input to Base64 and returns the result

local inputByteArray = {105, 110, 112, 117, 116, 32, 116, 111, 32, 101, 110, 99, 111, 100, 101}
local baseEncodeByte = Space.String.Base64Encode(inputByteArray)
Space.Log(baseEncodeByte)
-- prints "aW5wdXQgdG8gZW5jb2Rl"


Base64Decode

string Base64Decode (string input);

Converts input from Base64 and returns the result

No example provided yet


GetBytes[]

byte GetBytes[] (string input);

Converts input to bytes using UTF8 encoding

No example provided yet


GetString

string GetString (byte[] input);

Converts input to a UTF8 string

No example provided yet