1 // Copyright 2015 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 (!amd64 || appengine) && (!386 || appengine) && (!ppc64le || appengine)
6 // +build !amd64 appengine
7 // +build !386 appengine
8 // +build !ppc64le appengine
9 10 package sha3
11 12 import "encoding/binary"
13 14 // xorIn xors the bytes in buf into the state; it
15 // makes no non-portable assumptions about memory layout
16 // or alignment.
17 func xorIn(d *State, buf []byte) {
18 n := len(buf) / 8
19 20 for i := 0; i < n; i++ {
21 a := binary.LittleEndian.Uint64(buf)
22 d.a[i] ^= a
23 buf = buf[8:]
24 }
25 }
26 27 // copyOut copies ulint64s to a byte buffer.
28 func copyOut(d *State, b []byte) {
29 for i := 0; len(b) >= 8; i++ {
30 binary.LittleEndian.PutUint64(b, d.a[i])
31 b = b[8:]
32 }
33 }
34