add base files

This commit is contained in:
Jeff Becker
2016-01-28 10:16:26 -05:00
parent 581742fcc4
commit 67d49585af
28 changed files with 634 additions and 0 deletions

View File

@ -0,0 +1,11 @@
//
// base32 encoding using i2p's alphabet
//
package base32
import (
b32 "encoding/base32"
)
// i2p base32 encoding
var I2PEncoding *b32.Encoding = b32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567")

View File

@ -0,0 +1,11 @@
//
// base64 encoding with i2p's alphabet
//
package base64
import (
b64 "encoding/base64"
)
// i2p base64 encoding
var I2PEncoding *b64.Encoding = b64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~")

5
lib/common/data.go Normal file
View File

@ -0,0 +1,5 @@
package common
// the sha256 of some datastructure
type IdentHash [32]byte

14
lib/common/utils.go Normal file
View File

@ -0,0 +1,14 @@
package common
import (
"os"
)
// check if a file is there and writeable
func FileExists(fname string) (exists bool) {
_, err := os.Stat(fname)
if err == nil {
exists = true
}
return
}