github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/crypto/internal/alias/alias.go (about)

     1  // Copyright 2018 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  // Package alias implements memory aliasing tests.
     6  // This code also exists as golang.org/x/crypto/internal/alias.
     7  package alias
     8  
     9  // AnyOverlap reports whether x and y share memory at any (not necessarily
    10  // corresponding) index. The memory beyond the slice length is ignored.
    11  func AnyOverlap(x, y []byte) bool
    12  
    13  // InexactOverlap reports whether x and y share memory at any non-corresponding
    14  // index. The memory beyond the slice length is ignored. Note that x and y can
    15  // have different lengths and still not have any inexact overlap.
    16  //
    17  // InexactOverlap can be used to implement the requirements of the crypto/cipher
    18  // AEAD, Block, BlockMode and Stream interfaces.
    19  func InexactOverlap(x, y []byte) bool