github.com/linapex/ethereum-dpos-chinese@v0.0.0-20190316121959-b78b3a4a1ece/swarm/storage/swarmhasher.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 12:09:50</date> 10 //</624342684449902592> 11 12 // 13 // 14 // 15 // 16 // 17 // 18 // 19 // 20 // 21 // 22 // 23 // 24 // 25 // 26 // 27 28 package storage 29 30 import ( 31 "hash" 32 ) 33 34 const ( 35 BMTHash = "BMT" 36 SHA3Hash = "SHA3" // 37 DefaultHash = BMTHash 38 ) 39 40 type SwarmHash interface { 41 hash.Hash 42 ResetWithLength([]byte) 43 } 44 45 type HashWithLength struct { 46 hash.Hash 47 } 48 49 func (h *HashWithLength) ResetWithLength(length []byte) { 50 h.Reset() 51 h.Write(length) 52 } 53