OSDN Git Service

new repo
[bytom/vapor.git] / vendor / golang.org / x / crypto / salsa20 / salsa / salsa20_amd64.go
1 // Copyright 2012 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 // +build amd64,!appengine,!gccgo
6
7 package salsa
8
9 // This function is implemented in salsa2020_amd64.s.
10
11 //go:noescape
12
13 func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte)
14
15 // XORKeyStream crypts bytes from in to out using the given key and counters.
16 // In and out may be the same slice but otherwise should not overlap. Counter
17 // contains the raw salsa20 counter bytes (both nonce and block counter).
18 func XORKeyStream(out, in []byte, counter *[16]byte, key *[32]byte) {
19         if len(in) == 0 {
20                 return
21         }
22         salsa2020XORKeyStream(&out[0], &in[0], uint64(len(in)), &counter[0], &key[0])
23 }