Source File
xor_unaligned.go
Belonging Package
golang.org/x/crypto/sha3
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (amd64 || 386 || ppc64le) && !purego
// +build amd64 386 ppc64le
// +build !purego
package sha3
import
// A storageBuf is an aligned array of maxRate bytes.
type storageBuf [maxRate / 8]uint64
func ( *storageBuf) () *[maxRate]byte {
return (*[maxRate]byte)(unsafe.Pointer())
}
// xorInUnaligned uses unaligned reads and writes to update d.a to contain d.a
// XOR buf.
func ( *state, []byte) {
:= len()
:= (*[maxRate / 8]uint64)(unsafe.Pointer(&[0]))[: /8 : /8]
if >= 72 {
.a[0] ^= [0]
.a[1] ^= [1]
.a[2] ^= [2]
.a[3] ^= [3]
.a[4] ^= [4]
.a[5] ^= [5]
.a[6] ^= [6]
.a[7] ^= [7]
.a[8] ^= [8]
}
if >= 104 {
.a[9] ^= [9]
.a[10] ^= [10]
.a[11] ^= [11]
.a[12] ^= [12]
}
if >= 136 {
.a[13] ^= [13]
.a[14] ^= [14]
.a[15] ^= [15]
.a[16] ^= [16]
}
if >= 144 {
.a[17] ^= [17]
}
if >= 168 {
.a[18] ^= [18]
.a[19] ^= [19]
.a[20] ^= [20]
}
}
func ( *state, []byte) {
:= (*[maxRate]uint8)(unsafe.Pointer(&.a[0]))
copy(, [:])
}
var (
xorIn = xorInUnaligned
copyOut = copyOutUnaligned
)
const xorImplementationUnaligned = "unaligned"
The pages are generated with Golds v0.4.9. (GOOS=linux GOARCH=amd64)