Botan

Memory Operations

License
Botan is released under the Simplified BSD License (see LICENSE.md)

void  zap(T, Alloc)(ref Vector!(T, Alloc) vec);

Zeroise the values then free the memory

Parameters
Vector!(T, Alloc) vec the vector to zeroise and free

void  clearMem(T)(T* ptr, size_t n);

Zeroise memory

Parameters
T* ptr a pointer to an array
size_t n the number of Ts pointed to by ptr

void  copyMem(T)(T* output, in T* input, in size_t n);

Copy memory

Parameters
T* output the destination array
T* input the source array
size_t n the number of elements of in/out

void  setMem(T)(T* ptr, size_t n, ubyte val);

Set memory to a fixed value

Parameters
T* ptr a pointer to an array
size_t n the number of Ts pointed to by ptr
ubyte val the value to set each ubyte to

bool  sameMem(T)(in T* p1, in T* p2, in size_t n);

Memory comparison, input insensitive

Parameters
T* p1 a pointer to an array
T* p2 a pointer to another array
size_t n the number of Ts in p1 and p2
Returns
true iff p1[i] == p2[i] forall i in [0...n)

void  zeroise(T, Alloc)(ref Vector!(T, Alloc) vec);

Zeroise the values; length remains unchanged

Parameters
Vector!(T, Alloc) vec the vector to  zeroise