Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aviate-labs/encoding.mo
Encoding Package for Motoko
https://github.com/aviate-labs/encoding.mo
base32 base64 hex motoko
Last synced: 3 months ago
JSON representation
Encoding Package for Motoko
- Host: GitHub
- URL: https://github.com/aviate-labs/encoding.mo
- Owner: aviate-labs
- License: apache-2.0
- Created: 2021-08-06T11:04:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-15T21:53:34.000Z (almost 2 years ago)
- Last Synced: 2024-04-19T01:33:41.432Z (7 months ago)
- Topics: base32, base64, hex, motoko
- Language: Motoko
- Homepage:
- Size: 26.4 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-motoko - motoko-Encode - Base32, Hex and Binary Library for the Motoko. (Libraries / Encoding)
README
# Encoding
[![Docs](https://img.shields.io/badge/dfx-0.12.1-yellow)](https://dfinity.org/developers)
## Base32
Implements base32 encoding as specified by RFC 4648.
## Base64
Implements base64 encoding as specified by RFC 4648.
## Binary
Provides simple translation between numbers and byte sequences.
### Usage
```motoko
Binary.LittleEndian.fromNat16(0xFF)
// [255, 0]Binary.BigEndian.fromNat16(0xFF)
// [0, 255]
```## Hex
Provides hexadecimal encoding and decoding methods for Motoko.
### Usage
Encode an array of unsigned 8-bit integers in hexadecimal format.
```motoko
encode(ns : [Nat8]) : Text
```Decode an array of unsigned 8-bit integers in hexadecimal format.
```motoko
decode(t : Text) : Result<[Nat8],Text>
```