Documentation ¶
Index ¶
Constants ¶
const Base64WebSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Base64WebSet is the standard base64 set for encoding data(e.g. images) in html files. However, this is not secure for using in URLs due to the '/' character
const EasilyReadableCodeSet = "*)23456789abcdefghi_klmnopqrstuvwxyzABCDEFGH+JKLMNOPQRSTUVWXYZ-$"
EasilyReadableCodeSet is a set with no characters that look alike (e.g. 0 & O, l & I)
const StandardCodeSet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"
StandardCodeSet is the default, http safe code set of base64encoding
Variables ¶
var ( // ErrNotDistinct indicates that a code set was provided that has at least two times the same rune ErrNotDistinct = errors.New("base64encoding: characters in codeSet are not pairwise distinct") // ErrIllegalRune inidcates that the code set had runes that were not legal ErrIllegalRune = errors.New(`base64encoding error: illegal rune: at least one character of the provided code set is not an ASCII or extended ASCII character`) )
Functions ¶
This section is empty.
Types ¶
type Encoder64 ¶
type Encoder64 struct {
// contains filtered or unexported fields
}
Encoder64 with multiple methods. Contains codeSet
func NewCustom ¶
NewCustom returns a new Encoder64 with the provided custom 64 character code set and an error if the set is unfit. Please note: the first (left most) character of the string will be the least significant character (0 * 64^n), while the last will be the most significant(63 * 64^n)
func NewWeb ¶
func NewWeb() Encoder64
NewWeb returns a new Encoder64 with the base64web encoding set used for encoding data in html
func (Encoder64) Decode ¶
Decode decodes a given string and returns an error if the string is not in a correct format
func (Encoder64) DecodeNum ¶
DecodeNum decodes a given string, converts it to an unsigned int64 and returns an error if the string is not in a correct format