From 528a53f7f76f08af5902f4cfa8235380b3434ba0 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Mon, 25 Apr 2022 00:43:06 +0200 Subject: drafty types refactor with simple ascii package types.go compiles but that is about it, here be dragons. Pushing so that we can get an idea of what this refactor would roughly look like. --- pkg/types/crypto.go | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 pkg/types/crypto.go (limited to 'pkg/types/crypto.go') diff --git a/pkg/types/crypto.go b/pkg/types/crypto.go deleted file mode 100644 index df93108..0000000 --- a/pkg/types/crypto.go +++ /dev/null @@ -1,30 +0,0 @@ -package types - -import ( - "crypto/ed25519" - "crypto/sha256" -) - -const ( - HashSize = sha256.Size - SignatureSize = ed25519.SignatureSize - PublicKeySize = ed25519.PublicKeySize - - LeafNodePrefix = byte(0x00) - InteriorNodePrefix = byte(0x01) -) - -type ( - Hash [HashSize]byte - Signature [SignatureSize]byte - PublicKey [PublicKeySize]byte -) - -func HashFn(buf []byte) *Hash { - var hash Hash = sha256.Sum256(buf) - return &hash -} - -func LeafHash(buf []byte) *Hash { - return HashFn(append([]byte{LeafNodePrefix}, buf...)) -} -- cgit v1.2.3