https://github.com/fluency03/scala-multibase
Scala implementation of Multibase (https://github.com/multiformats/multibase).
https://github.com/fluency03/scala-multibase
Last synced: 10 months ago
JSON representation
Scala implementation of Multibase (https://github.com/multiformats/multibase).
- Host: GitHub
- URL: https://github.com/fluency03/scala-multibase
- Owner: fluency03
- License: mit
- Created: 2018-11-10T00:01:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-26T19:09:14.000Z (over 6 years ago)
- Last Synced: 2025-01-23T06:44:58.373Z (12 months ago)
- Language: Scala
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scala-multibase
[](https://github.com/fluency03/scala-multibase/releases/latest)
[](https://search.maven.org/search?q=g:%22com.github.fluency03%22%20AND%20a:%22scala-multibase_2.12%22)
[](https://github.com/RichardLitt/standard-readme)
> Scala Implementation of [Multibase](https://github.com/multiformats/multibase).
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [License](#license)
## Install
#### Maven
```xml
com.github.fluency03
scala-multibase_2.12
{latestVersion}
```
#### sbt
```scala
libraryDependencies += "com.github.fluency03" % "scala-multibase_2.12" % {latestVersion}
```
## Usage
```scala
import com.github.fluency03.multibase.Multibase
import com.github.fluency03.multibase.Base._
val str = "Multibase is awesome! \\o/"
Multibase.encodeString(Base32Upper, str) // BJV2WY5DJMJQXGZJANFZSAYLXMVZW63LFEEQFY3ZP
Multibase.encodeString(Base32Pad, str) // cjv2wy5djmjqxgzjanfzsaylxmvzw63lfeeqfy3zp
Multibase.encodeString(Base32PadUpper, str) // CJV2WY5DJMJQXGZJANFZSAYLXMVZW63LFEEQFY3ZP
Multibase.encodeString(Base32Z, str) // hji4sa7djcjozg3jypf31yamzci3s65mfrrofa53x
Multibase.encodeString(Base58Flickr, str) // ZxaJjNnAzU5jHQLhoLrXxcVM66Ca1VkLWAT
Multibase.encodeString(Base58BTC, str) // zYAjKoNbau5KiqmHPmSxYCvn66dA1vLmwbt
Multibase.encodeString(Base64, str) // mTXVsdGliYXNlIGlzIGF3ZXNvbWUhIFxvLw
Multibase.encodeString(Base64Pad, str) // MTXVsdGliYXNlIGlzIGF3ZXNvbWUhIFxvLw==
Multibase.encodeString(Base64URL, str) // uTXVsdGliYXNlIGlzIGF3ZXNvbWUhIFxvLw
Multibase.encodeString(Base64URLPad, str) // UTXVsdGliYXNlIGlzIGF3ZXNvbWUhIFxvLw==
val encodedStr: String = Multibase.encode(Base16, str.getBytes)
// encodedStr: String = f4d756c74696261736520697320617765736f6d6521205c6f2f
val decodedBytes: Array[Byte] = Multibase.decode(encodedStr)
// decodedBytes: Array[Byte] = Array(77, 117, 108, 116, 105, 98, 97, 115, 101, 32, 105, 115, 32, 97, 119, 101, 115, 111, 109, 101, 33, 32, 92, 111, 47)
val decodedStr = new String(decodedBytes)
// decodedStr: String = Multibase is awesome! \o/
```
## API
## Maintainers
[@fluency03](https://github.com/fluency03)
## Contribute
PRs accepted.
Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
## License
MIT © 2018 [@fluency03](https://github.com/fluency03)