libp2p/crypto/rng

Search:
Group by:
Source   Edit  

Types

Rng = ref object
Source   Edit  

Procs

proc generate(rng: Rng; T: type): T:type {.noinit, ...raises: [].}
Create a new instance of T filled with random data. Source   Edit  
proc generate[T](rng: Rng; v: var T) {....raises: [].}
Fill v with random data. v must be a simple type. Source   Edit  
proc generate[V](rng: Rng; v: var openArray[V]) {....raises: [].}
Fill v with random data. V must be a simple type. Source   Edit  
proc generateBytes(rng: Rng; n: int): seq[byte] {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc newBearSslRng(drbg: ref HmacDrbgContext): Rng {....raises: [], tags: [],
    forbids: [].}

Wrap an existing BearSSL HMAC-DRBG context.

This is a temporary compatibility API for the BearSSL to BoringSSL migration. New code should use newRng.

Source   Edit  
proc newRng(): Rng {....raises: [], tags: [RootEffect], forbids: [].}

Create a new randomness source for libp2p.

BearSSL remains the temporary backend in this migration phase.

Source   Edit  
proc pick[T](rng: Rng; x: openArray[T]; n: int): Opt[seq[T]] {....raises: [].}
Source   Edit  
proc pickOne[T](rng: Rng; x: openArray[T]): Opt[T] {....raises: [].}
Source   Edit  
proc shuffle[T](rng: Rng; x: var openArray[T]) {....raises: [].}
Source   Edit  

Templates

template bearSslDrbg(rng: Rng): untyped {..}
Source   Edit  
template bearSslDrbgRef(rng: Rng): untyped {..}
Source   Edit  
template bearSslPrng(rng: Rng): untyped {..}
Source   Edit  
template generate[V](rng: Rng; v: var seq[V]) {..}
Source   Edit