API
ChaChaCiphers.AbstractChaChaStreamChaChaCiphers.CUDAChaChaStreamChaChaCiphers.ChaChaStateChaChaCiphers.ChaChaStreamChaChaCiphers.CUDAChaCha12StreamChaChaCiphers.CUDAChaCha20StreamChaChaCiphers.ChaCha12StreamChaChaCiphers.ChaCha20StreamChaChaCiphers.decrypt!ChaChaCiphers.encrypt!ChaChaCiphers.getstate
ChaChaCiphers.AbstractChaChaStream — TypeAbstractChaChaStreamAbstract parent type for ChaCha keystreams.
ChaChaCiphers.CUDAChaChaStream — TypeCUDAChaChaStream <: AbstractChaChaStreamCUDAChaChaStream is a CUDA-compatible ChaCha keystream generator for GPU CRNG.
Examples
Create a CUDAChaChaStream with a randomized key, and sample some random numbers with it:
julia> rng = CUDAChaChaStream();
julia> x = CuVector{Float32}(undef, 2^10);See also: ChaChaStream
ChaChaCiphers.ChaChaState — TypeChaChaStateA NamedTuple storing the current state of a ChaCha keystream. ChaChaState can be used to save and restore the state of a keystream.
ChaChaCiphers.ChaChaStream — TypeChaChaStream <: AbstractChaChaStreamChaChaStream provides access to the keystream generated by the ChaCha stream cipher. It can be used as a cryptographically secure random number generator (CRNG) for Julia's random number generation functions.
Examples
Create a ChaChaStream with a randomly-generated key and nonce:
julia> stream = ChaCha20Stream();Create a ChaChaStream with a pre-specified key and nonce, and use it to generate random data:
julia> key = UInt32.([
0xe2e39848, 0x70bb974d, 0x845f88b4, 0xb30725e4,
0x15c309dc, 0x72d545bb, 0x466e99e3, 0x6a759f91
]);
julia> nonce = UInt64(1234);
julia> stream = ChaCha20Stream(key, nonce);
julia> randn(stream)
0.7689072580509484
julia> randstring(stream, 'a':'z', 8)
"klmptewr"See also: CUDAChaChaStream
ChaChaCiphers.CUDAChaCha12Stream — MethodCUDAChaCha12StreamCreate a CUDA-compatible keystream for a ChaCha12 stream cipher.
ChaChaCiphers.CUDAChaCha20Stream — MethodCUDAChaCha20StreamCreate a CUDA-compatible keystream for a ChaCha20 stream cipher.
ChaChaCiphers.ChaCha12Stream — MethodChaCha12Stream(args...)Create a keystream for a ChaCha12 stream cipher.
ChaChaCiphers.ChaCha20Stream — MethodChaCha20Stream(args...)Create a keystream for a ChaCha20 stream cipher.
ChaChaCiphers.decrypt! — Methoddecrypt(stream::ChaChaStream, x)
decrypt!(stream::ChaChaStream, x)Decrypt an encrypted vector x using the keystream from a ChaChaStream.
ChaChaCiphers.encrypt! — Methodencrypt(stream::ChaChaStream, x)
encrypt!(stream::ChaChaStream, x)Encrypt a vector or string x using the keystream from a ChaChaStream.
ChaChaCiphers.getstate — Methodgetstate(stream::AbstractChaChaStream)Return a NamedTuple containing enough state of the input AbstractChaChaStream to be able to reproduce it.