libp2p/crypto/chacha20poly1305

    Dark Mode
Search:
Group by:
  Source   Edit

This module integrates BearSSL ChaCha20+Poly1305

This module uses unmodified parts of code from BearSSL library <https://bearssl.org/> Copyright(C) 2018 Thomas Pornin <pornin@bolet.org>.

Types

ChaChaPoly = object
  Source   Edit
ChaChaPolyKey = array[ChaChaPolyKeySize, byte]
  Source   Edit
ChaChaPolyNonce = array[ChaChaPolyNonceSize, byte]
  Source   Edit
ChaChaPolyTag = array[ChaChaPolyTagSize, byte]
  Source   Edit

Procs

proc decrypt(_: type[ChaChaPoly]; key: ChaChaPolyKey; nonce: ChaChaPolyNonce;
             tag: var ChaChaPolyTag; data: var openArray[byte];
             aad: openArray[byte]) {....raises: [].}
  Source   Edit
proc encrypt(_: type[ChaChaPoly]; key: ChaChaPolyKey; nonce: ChaChaPolyNonce;
             tag: var ChaChaPolyTag; data: var openArray[byte];
             aad: openArray[byte]) {....raises: [].}
  Source   Edit
proc intoChaChaPolyKey(s: openArray[byte]): ChaChaPolyKey {....raises: [], tags: [].}
  Source   Edit
proc intoChaChaPolyNonce(s: openArray[byte]): ChaChaPolyNonce {....raises: [],
    tags: [].}
  Source   Edit
proc intoChaChaPolyTag(s: openArray[byte]): ChaChaPolyTag {....raises: [], tags: [].}
  Source   Edit