github.com/deso-protocol/core@v1.2.9/desohash/sha3m/hashes.go (about) 1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package sha3m 6 7 // This file provides functions for creating instances of the SHA-3m function 8 9 import ( 10 "hash" 11 ) 12 13 // New256 creates a new SHA3-256 hash. 14 // Its generic security strength is 256 bits against preimage attacks, 15 // and 128 bits against collision attacks. 16 func New256() hash.Hash { 17 return &state{rate: 136, outputLen: 32, dsbyte: 0x06} 18 } 19 20 // Sum256 returns the SHA3-256 digest of the data. 21 func Sum256(data []byte) (digest [32]byte) { 22 h := New256() 23 h.Write(data) 24 h.Sum(digest[:0]) 25 return 26 }