4 Commits

Author SHA1 Message Date
Jeromy
64b00b0f1a gx publish v0.2.1 2016-10-24 15:32:13 -07:00
Jeromy
ed7d4b3b12 guard against empty strings 2016-10-24 15:31:20 -07:00
Jeromy Johnson
2c9be8ec36 Merge pull request #4 from multiformats/feat/license-and-doc
Add license and standardize README
2016-10-14 10:54:33 -04:00
Richard Littauer
528883f051 Add license and standardize README
Still needs Usage section. I wasnt able to see this on godoc.org; how do I publish the godoc? Also, the license needs to be checked. This will close #3
2016-10-14 10:53:31 -04:00
6 changed files with 60 additions and 4 deletions

View File

@@ -1 +1 @@
0.2.0: QmYiTi9mKBMjfiup7na7PhJK7QEZPdMTJenLdgFYVQ2NUv
0.2.1: QmUq3H9YpcPphbRj6ct6rBgBE377A8wANP8zPMRqe1WYbf

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Protocol Labs Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,7 +1,32 @@
go-multibase
==============
# go-multibase
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
> Go implementation of the [multibase](https://github.com/multiformats/multibase) specification.
## Install
```sh
go get github.com/multiformats/go-multibase
```
## Usage
TODO
## Maintainer
Captain: [@whyrusleeping](https://github.com/whyrusleeping).
## Contribute
Contributions welcome. Please check out [the issues](https://github.com/multiformats/go-multibase/issues).
Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
## License
[MIT](LICENSE) © Protocol Labs Inc.

View File

@@ -31,6 +31,10 @@ func Encode(base int, data []byte) (string, error) {
}
func Decode(data string) (int, []byte, error) {
if len(data) == 0 {
return 0, nil, fmt.Errorf("cannot decode multibase for zero length string")
}
switch data[0] {
case Base58BTC:
return Base58BTC, b58.DecodeAlphabet(data[1:], b58.BTCAlphabet), nil

View File

@@ -27,4 +27,9 @@ func TestBase58RoundTrip(t *testing.T) {
if !bytes.Equal(buf, out) {
t.Fatal("input wasnt the same as output", buf, out)
}
_, _, err = Decode("")
if err == nil {
t.Fatal("shouldnt be able to decode empty string")
}
}

View File

@@ -18,5 +18,6 @@
"language": "go",
"license": "",
"name": "go-multibase",
"version": "0.2.0"
"version": "0.2.1"
}