Source File
xor.go
Belonging Package
vendor/golang.org/x/crypto/chacha20
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found src the LICENSE file.
package chacha20
import
// Platforms that have fast unaligned 32-bit little endian accesses.
const unaligned = runtime.GOARCH == "386" ||
runtime.GOARCH == "amd64" ||
runtime.GOARCH == "arm64" ||
runtime.GOARCH == "ppc64le" ||
runtime.GOARCH == "s390x"
// addXor reads a little endian uint32 from src, XORs it with (a + b) and
// places the result in little endian byte order in dst.
func addXor(, []byte, , uint32) {
_, _ = [3], [3] // bounds check elimination hint
if unaligned {
// The compiler should optimize this code into
// 32-bit unaligned little endian loads and stores.
// TODO: delete once the compiler does a reliably
// good job with the generic code below.
// See issue #25111 for more details.
:= uint32([0])
|= uint32([1]) << 8
|= uint32([2]) << 16
|= uint32([3]) << 24
^= +
[0] = byte()
[1] = byte( >> 8)
[2] = byte( >> 16)
[3] = byte( >> 24)
} else {
+=
[0] = [0] ^ byte()
[1] = [1] ^ byte(>>8)
[2] = [2] ^ byte(>>16)
[3] = [3] ^ byte(>>24)
}
}
The pages are generated with Golds v0.7.0-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |