base64

Summit base64 encoding library.

Used for endcoding and decoding base64 strings. See http://en.wikipedia.org/wiki/Base64 for details.

Functions

Name Summary
decode

Base64-decode some string of data.

encode

Base64-encode some string of data.

Functions : base64

decode(data)

Base64-decode some string of data. This function will take a Base64-encoded string and decode it.

Parameters
Name Type Default Summary

data

string

Some string of data to decode.

Returns
Type Summary

string

A string of the decoded data.

Usage
local log = require("summit.log")
local base64 = require("summit.base64")

channel.answer()

channel.say("Hello, this is the base 64 summit library")

local my_string = "dGhpcyBpcyBhIHNhbXBsZSBzdHJpbmc="

-- The value of the decoded string will be: "this is a sample string"
local decoded = base64.decode(my_string)

log.info("'"..my_string.."' decodes to: ".. decoded)

channel.say("Your sample string decodes to, "..decoded)
channel.say("Goodbye")
channel.hangup()

encode(data)

Base64-encode some string of data. This function will take a string of data and return a Base64-encoded version of that data.

Parameters
Name Type Default Summary

data

string

Some string of data to encode.

Returns
Type Summary

string

Base64-encoded string of the input data

Usage
local log = require("summit.log")
local base64 = require("summit.base64")

channel.answer()

channel.say("Hello, this is the base 64 summit library")

local my_string = "this is a sample string"

-- The value of encoded will be "dGhpcyBpcyBhIHNhbXBsZSBzdHJpbmc="
local encoded = base64.encode(my_string)

log.info("'"..my_string.."' encodes to: "..encoded)

channel.say("I encoded your sample string. Check your call logs for details. Good bye")
channel.hangup()