// Generated by Lisette bindgen
// Source: crypto/cipher (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.14

import "go:io"

pub fn NewCBCDecrypter(b: Block, iv: Slice<uint8>) -> BlockMode

pub fn NewCBCEncrypter(b: Block, iv: Slice<uint8>) -> BlockMode

pub fn NewCFBDecrypter(block: Block, iv: Slice<uint8>) -> Stream

pub fn NewCFBEncrypter(block: Block, iv: Slice<uint8>) -> Stream

pub fn NewCTR(block: Block, iv: Slice<uint8>) -> Stream

pub fn NewGCM(cipher: Block) -> Result<AEAD, error>

pub fn NewGCMWithNonceSize(cipher: Block, size: int) -> Result<AEAD, error>

pub fn NewGCMWithRandomNonce(cipher: Block) -> Result<AEAD, error>

pub fn NewGCMWithTagSize(cipher: Block, tagSize: int) -> Result<AEAD, error>

pub fn NewOFB(b: Block, iv: Slice<uint8>) -> Stream

/// AEAD is a cipher mode providing authenticated encryption with associated
/// data. For a description of the methodology, see
/// https://en.wikipedia.org/wiki/Authenticated_encryption.
pub interface AEAD {
  fn NonceSize() -> int
  fn Open(
    mut dst: Slice<uint8>,
    nonce: Slice<uint8>,
    ciphertext: Slice<uint8>,
    additionalData: Slice<uint8>,
  ) -> Result<Slice<uint8>, error>
  fn Overhead() -> int
  fn Seal(
    mut dst: Slice<uint8>,
    nonce: Slice<uint8>,
    plaintext: Slice<uint8>,
    additionalData: Slice<uint8>,
  ) -> Slice<uint8>
}

/// A Block represents an implementation of block cipher
/// using a given key. It provides the capability to encrypt
/// or decrypt individual blocks. The mode implementations
/// extend that capability to streams of blocks.
pub interface Block {
  fn BlockSize() -> int
  fn Decrypt(mut dst: Slice<uint8>, src: Slice<uint8>)
  fn Encrypt(mut dst: Slice<uint8>, src: Slice<uint8>)
}

/// A BlockMode represents a block cipher running in a block-based mode (CBC,
/// ECB etc).
pub interface BlockMode {
  fn BlockSize() -> int
  fn CryptBlocks(mut dst: Slice<uint8>, src: Slice<uint8>)
}

/// A Stream represents a stream cipher.
pub interface Stream {
  fn XORKeyStream(mut dst: Slice<uint8>, src: Slice<uint8>)
}

/// StreamReader wraps a [Stream] into an [io.Reader]. It calls XORKeyStream
/// to process each slice of data which passes through.
pub struct StreamReader {
  pub S: Option<Stream>,
  pub R: Option<io.Reader>,
}

/// StreamWriter wraps a [Stream] into an io.Writer. It calls XORKeyStream
/// to process each slice of data which passes through. If any [StreamWriter.Write]
/// call returns short then the StreamWriter is out of sync and must be discarded.
/// A StreamWriter has no internal buffering; [StreamWriter.Close] does not need
/// to be called to flush write data.
pub struct StreamWriter {
  pub S: Option<Stream>,
  pub W: Option<io.Writer>,
  pub Err: error,
}

impl StreamReader {
  fn Read(self, mut dst: Slice<uint8>) -> Partial<int, error>
}

impl StreamWriter {
  /// Close closes the underlying Writer and returns its Close return value, if the Writer
  /// is also an io.Closer. Otherwise it returns nil.
  #[allow(unused_result)]
  fn Close(self) -> Result<(), error>

  fn Write(self, src: Slice<uint8>) -> Partial<int, error>
}
