Commit 5ed19983 authored by Janos Guljas's avatar Janos Guljas

add package swarm with Address type

parent fb308024
// Copyright 2020 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package swarm contains most basic and general Swarm concepts.
package swarm
import "encoding/hex"
// Address represents an address in Swarm metric space of
// Node and Chunk addresses.
type Address []byte
// NewAddress returns an Address from a hex-encoded string representation.
func NewAddress(s string) (Address, error) {
return hex.DecodeString(s)
}
// String returns a hex-encoded representation of the Address.
func (a Address) String() string {
return hex.EncodeToString(a)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment