Repository navigation
Functions Encoding
Home › Function Finder › Encoding, hashes and IDs
The functions to encode and decode Base64, hex and percent-encoding; hash and checksum data; generate UUIDs, grouped by what you want to do. The From column says what a program needs before it can call one:
-
std/<Name>:#import "std/<Name>", thenusing <Name>to call it by its bare name.
Jump to: Encode and decode base64 · Encode and decode hex · Percent-encode text for URLs · Encode and decode base32 · Find out why decoding failed · Hash or checksum data in one call · Pick a checksum or hash · Hash data in pieces · Sign and check a message with HMAC · Make a UUID · Turn a UUID into text or bytes and back · Inspect a UUID · Read numbers from a byte buffer · Write numbers into a byte buffer
| Function | What it does | From |
|---|---|---|
| Base64Encode | Returns bytes or a string as base64 text, in the standard or URL-safe alphabet. | std/codec |
| Base64Decode | Decodes base64 text into a byte array and returns the byte count, or an error. | std/codec |
| Base64DecodeText | Decodes base64 text straight to a string; the decoded bytes must be UTF-8. | std/codec |
| Function | What it does | From |
|---|---|---|
| HexEncode | Returns bytes or a string as hexadecimal text, two digits a byte, lower or upper case. | std/codec |
| HexDecode | Decodes hexadecimal text into a byte array and returns the byte count, or an error. | std/codec |
| HexDecodeText | Decodes hexadecimal text straight to a string; the decoded bytes must be UTF-8. | std/codec |
| Function | What it does | From |
|---|---|---|
| PercentEncode | Returns text with the characters a URL cannot hold written as %XX escapes. | std/codec |
| PercentDecode | Turns %XX escapes, and + in query mode, back into text, or returns an error. | std/codec |
| Function | What it does | From |
|---|---|---|
| Base32Encode | Returns bytes or a string as base32 text, in the standard or sortable hex alphabet. | std/codec |
| Base32Decode | Decodes base32 text into a byte array and returns the byte count, or an error. | std/codec |
| Base32DecodeText | Decodes base32 text straight to a string; the decoded bytes must be UTF-8. | std/codec |
| Function | What it does | From |
|---|---|---|
| EncodingError | Holds why decoding failed: a code, the position of the first bad character, a message. | std/codec |
| Function | What it does | From |
|---|---|---|
| Digest | Returns the digest of text or a byte array as bytes, for the algorithm named. | std/hash |
| DigestHex | Returns the digest of text or a byte array as lower-case hex. | std/hash |
| DigestFile | Returns the digest of a whole file, read in 64 KB pieces, or why it could not be read. | std/hash |
| HashStream | Feeds a stream from where it is to its end into a hasher; returns the bytes read. | std/hash |
| HashAlgorithm | Names the algorithms the one-call functions take, from HASH_CRC32 to HASH_SHA512. | std/hash |
| NewHasher | Returns a new hasher for an algorithm, which the caller deletes, or nullptr. | std/hash |
| Function | What it does | From |
|---|---|---|
| Crc32 | Holds a CRC-32 checksum, the 4-byte one zip, gzip and PNG use. | std/hash |
| Crc32C | Holds a CRC-32C checksum, the 4-byte one iSCSI and ext4 use. | std/hash |
| Adler32 | Holds an Adler-32 checksum, the 4-byte one zlib streams use. | std/hash |
| Fnv1a32 | Holds a 32-bit FNV-1a hash, quick for short keys; not for security. | std/hash |
| Fnv1a64 | Holds a 64-bit FNV-1a hash, quick for short keys; not for security. | std/hash |
| XxHash64 | Holds a 64-bit xxHash with an optional seed, fast on large data; not for security. | std/hash |
| Md5 | Holds a 16-byte MD5 hash, only for matching formats that already use it. | std/hash |
| Sha1 | Holds a 20-byte SHA-1 hash, only for matching formats that already use it. | std/hash |
| Sha224 | Holds a 28-byte SHA-224 hash, for data someone could tamper with. | std/hash |
| Sha256 | Holds a 32-byte SHA-256 hash, for data someone could tamper with. | std/hash |
| Sha384 | Holds a 48-byte SHA-384 hash, faster than SHA-256 on long messages on 64-bit machines. | std/hash |
| Sha512 | Holds a 64-byte SHA-512 hash, faster than SHA-256 on long messages on 64-bit machines. | std/hash |
| Function | What it does | From |
|---|---|---|
| Hasher | Holds what every hash type shares, so one procedure can take any of them. | std/hash |
| Hasher.Update | Adds a number of bytes at a pointer to the hash. | std/hash |
| Hasher.UpdateBytes | Adds the bytes of an Array to the hash. | std/hash |
| Hasher.UpdateText | Adds text to the hash as its UTF-8 bytes. | std/hash |
| Hasher.UpdateRaw | Adds the bytes of a string to the hash as they are, with no conversion. | std/hash |
| Hasher.Finish | Returns the digest so far as bytes; more data can still be added after it. | std/hash |
| Hasher.FinishHex | Returns the digest so far as lower-case hex; more data can still be added after it. | std/hash |
| Hasher.Reset | Forgets everything added and starts the hash again. | std/hash |
| Hasher.DigestSize | Returns the size of the digest in bytes. | std/hash |
| Hasher.BlockSize | Returns the size of the block the algorithm works on, in bytes. | std/hash |
| Sum32 / Sum64 | Returns a checksum or fast hash as a number instead of bytes. | std/hash |
| Function | What it does | From |
|---|---|---|
| Hmac | Holds an HMAC: a cryptographic hash with a key, which is itself a Hasher. | std/hash |
| HmacHex | Returns the HMAC of a message under a key as lower-case hex, in one call. | std/hash |
| ConstantTimeEquals | Returns true if two byte arrays match, taking the same time whichever byte differs. | std/hash |
| Function | What it does | From |
|---|---|---|
| Uuid | Holds a 128-bit identifier that can be compared, sorted and used as a Map key. | std/uuids |
| NewV4 | Returns a new random UUID from the system's secure random generator. | std/uuids |
| NewV7 | Returns a new UUID that starts with the time, so each one sorts after the one before. | std/uuids |
| NilUuid | Returns the nil UUID, with all 16 bytes zero. | std/uuids |
| MaxUuid | Returns the max UUID, with every bit set. | std/uuids |
| Function | What it does | From |
|---|---|---|
| Parse | Parses a UUID with or without hyphens, braces or a urn:uuid: prefix, or returns an error. | std/uuids |
| Uuid.ToString | Returns the UUID as 36 characters of lower-case text in the 8-4-4-4-12 form. | std/uuids |
| FromBytes | Returns a UUID from an array of exactly 16 bytes, or an error. | std/uuids |
| Uuid.ToBytes | Returns the UUID's 16 bytes as an Array. | std/uuids |
| UuidError | Holds why a UUID did not parse: a code and the position of the offending character. | std/uuids |
| Function | What it does | From |
|---|---|---|
| Uuid.Version | Returns the UUID's version, such as 4 or 7, or 0 for the nil UUID. | std/uuids |
| Uuid.Variant | Returns the UUID's variant field, which is 1 for every standard UUID. | std/uuids |
| Uuid.IsNil | Returns true if all 16 bytes of the UUID are zero. | std/uuids |
| Uuid.UnixMillis | Returns when a version 7 UUID was made, in Unix milliseconds, or -1 for any other. | std/uuids |
| Uuid.HashOf | Returns a hash of the UUID, used when it is a Map or Set key. | std/uuids |
| Function | What it does | From |
|---|---|---|
| GetU16LE … GetF64BE | Reads a fixed-width integer or float at a byte offset, little- or big-endian. | std/codec |
| ReadUVarint | Reads an unsigned variable-length integer at an offset and moves the offset past it. | std/codec |
| ReadVarint | Reads a signed variable-length integer at an offset and moves the offset past it. | std/codec |
| Function | What it does | From |
|---|---|---|
| PutU16LE … PutF64BE | Writes a fixed-width number at a byte offset, growing the array if it is too short. | std/codec |
| AppendU16LE … AppendF64BE | Adds a fixed-width number to the end of a byte array, little- or big-endian. | std/codec |
| AppendUVarint | Adds an unsigned integer to a byte array in as few bytes as it needs. | std/codec |
| AppendVarint | Adds a signed integer to a byte array, keeping small negative numbers short. | std/codec |
- Codec guide
- Hash guide
- UUID guide
- Array, which holds the bytes
- Result, which the decoders and Parse return
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Home
- What Is tiko-lang
- Quick Start
- Installing on macOS
- Debugging
- Feature Index
- Compatibility
- FAQ
- AI Cheatsheet
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Time Zones
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing