You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
764 B

  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. // +build amd64,!appengine,!gccgo
  5. package salsa
  6. // This function is implemented in salsa2020_amd64.s.
  7. //go:noescape
  8. func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte)
  9. // XORKeyStream crypts bytes from in to out using the given key and counters.
  10. // In and out must overlap entirely or not at all. Counter
  11. // contains the raw salsa20 counter bytes (both nonce and block counter).
  12. func XORKeyStream(out, in []byte, counter *[16]byte, key *[32]byte) {
  13. if len(in) == 0 {
  14. return
  15. }
  16. _ = out[len(in)-1]
  17. salsa2020XORKeyStream(&out[0], &in[0], uint64(len(in)), &counter[0], &key[0])
  18. }