github.com/quantosnetwork/Quantos@v0.0.0-20220306172517-e20b28c5a29a/hashid/hashid.go (about) 1 package hashid 2 3 import ( 4 "bytes" 5 "github.com/quantosnetwork/Quantos/crypto" 6 "hash" 7 ) 8 9 /* 10 11 HashID = 12 13 ChainCode + Genesis Hash + Current block hash + Chain hash up to that block 14 15 @description 16 ## Purpose 17 Faster chain sync and more flexibility than when dealing with full structure. 18 19 */ 20 21 type hashID interface { 22 _buildHashId( 23 chainCode []byte, 24 genesisHash []byte, 25 currBlockHash []byte, 26 chainHash []byte) (hashID, error) 27 _verifyHashID() 28 _signHashID() 29 _getHashIDFromHashTable(hID string) []byte 30 _encodeHashId() []byte 31 _decodeHashId() hashID 32 _insertIntoHashTable() (int, error) 33 Set() 34 Get() 35 } 36 37 type HashID struct { 38 raw []byte 39 workBuffer *bytes.Buffer 40 hashFunc hash.Hash 41 ID hashID `json:"hash_id"` 42 HtID int 43 } 44 45 type HashIDSignature struct { 46 ID []byte 47 crypto.Signature 48 } 49 50 func (hid *HashID) _buildHashId( 51 chainCode []byte, 52 genesisHash []byte, 53 currBlockHash []byte, 54 chainHash []byte) (hashID, error) { 55 return nil, nil 56 } 57 58 func (hid *HashID) _verifyHashID() {} 59 60 func (hid *HashID) _signHashID() {} 61 62 func (hid *HashID) _getHashIDFromHashTable(hID string) []byte { 63 return nil 64 } 65 66 func (hid *HashID) _encodeHashId() []byte { 67 return nil 68 } 69 70 func (hid *HashID) _decodeHashId() hashID { 71 return nil 72 } 73 74 func (hid *HashID) _insertIntoHashTable() (int, error) { 75 return 0, nil 76 } 77 78 func (hid *HashID) Set() {} 79 80 func (hid *HashID) Get() {}