~edwargix/tallyard

ccb482442131c06044197796a60a96cbb01d337a — David Florness 4 years ago 2ca3ae1
Better filename and remove unneeded functions
2 files changed, 3 insertions(+), 21 deletions(-)

A election/candidate.go
D election/merkle.go
A election/candidate.go => election/candidate.go +3 -0
@@ 0,0 1,3 @@
package election

type Candidate string

D election/merkle.go => election/merkle.go +0 -21
@@ 1,21 0,0 @@
package election

import (
	"crypto/sha256"

	"github.com/cbergoon/merkletree"
)

type Candidate string

func (eo Candidate) CalculateHash() ([]byte, error) {
	h := sha256.New()
	if _, err := h.Write([]byte(eo)); err != nil {
		return nil, err
	}
	return h.Sum(nil), nil
}

func (eo Candidate) Equals(other merkletree.Content) (bool, error) {
	return eo == other.(Candidate), nil
}