add 44-char dest hashes

This commit is contained in:
idk
2019-12-07 17:26:28 -05:00
parent a12f9ba498
commit 6406efd277
3 changed files with 16 additions and 4 deletions

View File

@ -1,8 +1,10 @@
USER_GH=eyedeekay
VERSION=0.0.2
VERSION=0.32.01
echo:
@echo "type make version to do release $(VERSION)"
version:
gothub delete -s $(GITHUB_TOKEN) -u $(USER_GH) -r sam3 -t v$(VERSION) 2> /dev/null; true
gothub release -s $(GITHUB_TOKEN) -u $(USER_GH) -r sam3 -t v$(VERSION) -d "version $(VERSION)"

View File

@ -80,13 +80,23 @@ func DestHashFromString(str string) (dhash I2PDestHash, err error) {
return
}
// get string representation of i2p dest hash
// get string representation of i2p dest hash(base32 version)
func (h I2PDestHash) String() string {
b32addr := make([]byte, 56)
i2pB32enc.Encode(b32addr, h[:])
return string(b32addr[:52]) + ".b32.i2p"
}
// get base64 representation of i2p dest sha256 hash(the 44-character one)
func (h I2PDestHash) Hash() string {
hash := sha256.New()
hash.Write(h[:])
digest := hash.Sum(nil)
buf := make([]byte, 44)
i2pB64enc.Encode(buf, digest)
return string(buf)
}
// Returns "I2P"
func (h *I2PDestHash) Network() string {
return "I2P"

View File

@ -44,7 +44,7 @@ func Test_StreamingDial(t *testing.T) {
t.Fail()
return
}
fmt.Println("\tDialing i2p-projekt.i2p(", forumAddr.Base32(), ")")
fmt.Println("\tDialing i2p-projekt.i2p(", forumAddr.Base32(), forumAddr.DestHash().Hash(), ")")
conn, err := ss.DialI2P(forumAddr)
if err != nil {
fmt.Println(err.Error())