class Sodium::Nonce

Overview

This class implements best effort nonce reuse detection when multithreading is disabled Race conditions may occur if using the same object in multiple Fibers with multithreading enabled.

Defined in:

sodium/nonce.cr

Constant Summary

NONCE_SIZE = LibSodium::NONCE_SIZE.to_i

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(bytes : Bytes) #

[View source]

Class Method Detail

def self.random(random_source = Random::Secure) #

[View source]
def self.zero #

[View source]

Instance Method Detail

def bytesize(*args, **options) #

[View source]
def bytesize(*args, **options, &) #

[View source]
def dup #
Description copied from class Reference

Returns a shallow copy of this object.

This allocates a new object and copies the contents of self into it.


[View source]
def increment : Nil #

[View source]
def random(random_source = Random::Secure) : Nil #

[View source]
def reusable : Bool #

Only use with single use keys.


[View source]
def reusable=(val : Bool) : Bool #

[View source]
def to_slice : Bytes #

Returns bytes


[View source]
def used! : Nil #

[View source]
def used? : Bool #

[View source]