github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/internal/notsha256/sha256.go (about) 1 // Copyright 2009 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 notsha256 implements the NOTSHA256 algorithm, 6 // a hash defined as bitwise NOT of SHA256. 7 // It is used in situations where exact fidelity to SHA256 is unnecessary. 8 // In particular, it is used in the compiler toolchain, 9 // which cannot depend directly on cgo when GOEXPERIMENT=boringcrypto 10 // (and in that mode the real sha256 uses cgo). 11 package notsha256 12 13 import ( 14 "github.com/shogo82148/std/hash" 15 ) 16 17 // The size of a checksum in bytes. 18 const Size = 32 19 20 // The blocksize in bytes. 21 const BlockSize = 64 22 23 // New returns a new hash.Hash computing the NOTSHA256 checksum. 24 // state of the hash. 25 func New() hash.Hash 26 27 // Sum256 returns the SHA256 checksum of the data. 28 func Sum256(data []byte) [Size]byte