Table of Contents

Class Philox.State

Namespace
NumSharp
Assembly
NumSharp.dll

The Philox state — NumPy's {'bit_generator': 'Philox', 'state': {'counter': uint64[4], 'key': uint64[2]}, 'buffer': uint64[4], 'buffer_pos': int, 'has_uint32': int, 'uinteger': int} with the nested 'state' dict flattened.

public class Philox.State : BitGeneratorState
Inheritance
Philox.State
Inherited Members

Remarks

Unsealed, so a subclass engine that adds state of its own derives its snapshot from this class. Its GetStateCore() override returns the derived snapshot, which passes the typed state getter (a cast to Philox.State) and SetStateCore(BitGeneratorState) (an is State test); its SetStateCore(BitGeneratorState) override restores its own fields and calls the base for the engine's. Footgun: the bit_generator label stays "Philox" and the base SetStateCore(BitGeneratorState) takes any Philox.State, where NumPy labels a subclass's state with the subclass's class name and refuses another class's state.

Constructors

State()

Creates an empty state (fill the members before assigning it).

public State()

State(ulong[], ulong[], ulong[], int, int, uint)

Creates a state from its members.

public State(ulong[] counter, ulong[] key, ulong[] buffer, int buffer_pos, int has_uint32 = 0, uint uinteger = 0)

Parameters

counter ulong[]

The 256-bit counter, lowest word first (at least 4 words; extra words are ignored).

key ulong[]

The 128-bit key, lowest word first (at least 2 words).

buffer ulong[]

The current encrypted block (at least 4 words).

buffer_pos int

The index of the next unread block word; 4 or more means "encrypt a new block first".

has_uint32 int

Non-zero when a buffered 32-bit half is pending.

uinteger uint

The buffered 32-bit half.

Properties

bit_generator

NumPy's 'bit_generator' key: the name of the bit generator class this state belongs to.

public override string bit_generator { get; }

Property Value

string

buffer

The current encrypted block (NumPy state['buffer']).

public ulong[] buffer { get; set; }

Property Value

ulong[]

buffer_pos

The index of the next unread block word (NumPy state['buffer_pos']); 4 = exhausted.

public int buffer_pos { get; set; }

Property Value

int

counter

The 256-bit counter, lowest word first (NumPy state['state']['counter']).

public ulong[] counter { get; set; }

Property Value

ulong[]

has_uint32

Non-zero when a buffered 32-bit half is pending.

public int has_uint32 { get; set; }

Property Value

int

key

The 128-bit key, lowest word first (NumPy state['state']['key']).

public ulong[] key { get; set; }

Property Value

ulong[]

uinteger

The buffered 32-bit half.

public uint uinteger { get; set; }

Property Value

uint