Source file src/crypto/internal/fips140/sha3/sha3_loong64.go

     1  // Copyright 2026 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  //go:build !purego
     6  
     7  package sha3
     8  
     9  import (
    10  	"crypto/internal/fips140deps/cpu"
    11  	"crypto/internal/impl"
    12  )
    13  
    14  var useLSX = cpu.LOONG64HasLSX
    15  
    16  func init() {
    17  	impl.Register("sha3", "LSX", &useLSX)
    18  }
    19  
    20  //go:noescape
    21  func keccakF1600LSX(a *[200]byte)
    22  
    23  func keccakF1600(a *[200]byte) {
    24  	if useLSX {
    25  		keccakF1600LSX(a)
    26  	} else {
    27  		keccakF1600Generic(a)
    28  	}
    29  }
    30  
    31  func (d *Digest) write(p []byte) (n int, err error) {
    32  	return d.writeGeneric(p)
    33  }
    34  
    35  func (d *Digest) read(out []byte) (n int, err error) {
    36  	return d.readGeneric(out)
    37  }
    38  
    39  func (d *Digest) sum(b []byte) []byte {
    40  	return d.sumGeneric(b)
    41  }
    42  

View as plain text