Botan

Load/Store Operators

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

ushort  make_ushort(ubyte i0, ubyte i1);

Make a ushort from two bytes

Parameters
ubyte i0 the first ubyte
ubyte i1 the second ubyte
Returns
i0 || i1

uint  make_uint(ubyte i0, ubyte i1, ubyte i2, ubyte i3);

Make a uint from four bytes

Parameters
ubyte i0 the first ubyte
ubyte i1 the second ubyte
ubyte i2 the third ubyte
ubyte i3 the fourth ubyte
Returns
i0 || i1 || i2 || i3

ulong  make_ulong(ubyte i0, ubyte i1, ubyte i2, ubyte i3, ubyte i4, ubyte i5, ubyte i6, ubyte i7);

Make a ulong from eight bytes

Parameters
ubyte i0 the first ubyte
ubyte i1 the second ubyte
ubyte i2 the third ubyte
ubyte i3 the fourth ubyte
ubyte i4 the fifth ubyte
ubyte i5 the sixth ubyte
ubyte i6 the seventh ubyte
ubyte i7 the eighth ubyte
Returns
i0 || i1 || i2 || i3 || i4 || i5 || i6 || i7

T  loadBigEndian(T)(const(ubyte)* input, size_t off);

Load a big-endian word

Parameters
const(ubyte)* input a pointer to some bytes
size_t off an offset into the array
Returns
off'th T of in, as a big-endian value

T  loadLittleEndian(T)(const(ubyte)* input, size_t off);

Load a little-endian word

Parameters
const(ubyte)* input a pointer to some bytes
size_t off an offset into the array
Returns
off'th T of in, as a litte-endian value

ushort  loadBigEndian(T : ushort)(const(ubyte)* input, size_t off);

Load a big-endian ushort

Parameters
const(ubyte)* input a pointer to some bytes
size_t off an offset into the array
Returns
off'th ushort of in, as a big-endian value

ushort  loadLittleEndian(T : ushort)(const(ubyte)* input, size_t off);

Load a little-endian ushort

Parameters
const(ubyte)* input a pointer to some bytes
size_t off an offset into the array
Returns
off'th ushort of in, as a little-endian value

uint  loadBigEndian(T : uint)(const(ubyte)* input, size_t off);

Load a big-endian uint

Parameters
const(ubyte)* input a pointer to some bytes
size_t off an offset into the array
Returns
off'th uint of in, as a big-endian value

uint  loadLittleEndian(T : uint)(const(ubyte)* input, size_t off);

Load a little-endian uint

Parameters
const(ubyte)* input a pointer to some bytes
size_t off an offset into the array
Returns
off'th uint of in, as a little-endian value

ulong  loadBigEndian(T : ulong)(const(ubyte)* input, size_t off);

Load a big-endian ulong

Parameters
const(ubyte)* input a pointer to some bytes
size_t off an offset into the array
Returns
off'th ulong of in, as a big-endian value

ulong  loadLittleEndian(T : ulong)(const(ubyte)* input, size_t off);

Load a little-endian ulong

Parameters
const(ubyte)* input a pointer to some bytes
size_t off an offset into the array
Returns
off'th ulong of in, as a little-endian value

void  loadLittleEndian(T)(const(ubyte)* input, ref T x0, ref T x1);

Load two little-endian words

Parameters
const(ubyte)* input a pointer to some bytes
T x0 where the first word will be written
T x1 where the second word will be written

void  loadLittleEndian(T)(const(ubyte)* input, ref T x0, ref T x1, ref T x2, ref T x3);

Load four little-endian words

Parameters
const(ubyte)* input a pointer to some bytes
T x0 where the first word will be written
T x1 where the second word will be written
T x2 where the third word will be written
T x3 where the fourth word will be written

void  loadLittleEndian(T)(const(ubyte)* input, ref T x0, ref T x1, ref T x2, ref T x3, ref T x4, ref T x5, ref T x6, ref T x7);

Load eight little-endian words

Parameters
const(ubyte)* input a pointer to some bytes
T x0 where the first word will be written
T x1 where the second word will be written
T x2 where the third word will be written
T x3 where the fourth word will be written
T x4 where the fifth word will be written
T x5 where the sixth word will be written
T x6 where the seventh word will be written
T x7 where the eighth word will be written

void  loadLittleEndian(T)(T* output, const(ubyte)* input, size_t count);

Load a variable number of little-endian words

Parameters
T* output the output array of words
const(ubyte)* input the input array of bytes
size_t count how many words are in in

void  loadBigEndian(T)(const(ubyte)* input, ref T x0, ref T x1);

Load two big-endian words

Parameters
const(ubyte)* input a pointer to some bytes
T x0 where the first word will be written
T x1 where the second word will be written

void  loadBigEndian(T)(const(ubyte)* input, ref T x0, ref T x1, ref T x2, ref T x3);

Load four big-endian words

Parameters
const(ubyte)* input a pointer to some bytes
T x0 where the first word will be written
T x1 where the second word will be written
T x2 where the third word will be written
T x3 where the fourth word will be written

void  loadBigEndian(T)(const(ubyte)* input, ref T x0, ref T x1, ref T x2, ref T x3, ref T x4, ref T x5, ref T x6, ref T x7);

Load eight big-endian words

Parameters
const(ubyte)* input a pointer to some bytes
T x0 where the first word will be written
T x1 where the second word will be written
T x2 where the third word will be written
T x3 where the fourth word will be written
T x4 where the fifth word will be written
T x5 where the sixth word will be written
T x6 where the seventh word will be written
T x7 where the eighth word will be written

void  loadBigEndian(T)(T* output, const(ubyte)* input, size_t count);

Load a variable number of big-endian words

Parameters
T* output the output array of words
const(ubyte)* input the input array of bytes
size_t count how many words are in in

void  storeBigEndian(ushort input, ubyte[2]* output);

Store a big-endian ushort

Parameters
ushort input the input ushort
ubyte[2]* output the ubyte array to write to

void  storeLittleEndian(ushort input, ubyte[2]* output);

Store a little-endian ushort

Parameters
ushort input the input ushort
ubyte[2]* output the ubyte array to write to

void  storeBigEndian(uint input, ubyte[4]* output);

Store a big-endian uint

Parameters
uint input the input uint
ubyte[4]* output the ubyte array to write to

void  storeLittleEndian(uint input, ubyte[4]* output);

Store a little-endian uint

Parameters
uint input the input uint
ubyte[4]* output the ubyte array to write to

void  storeBigEndian(ulong input, ubyte[8]* output);

Store a big-endian ulong

Parameters
ulong input the input ulong
ubyte[8]* output the ubyte array to write to

void  storeLittleEndian(in ulong input, ubyte[8]* output);

Store a little-endian ulong

Parameters
ulong input the input ulong
ubyte[8]* output the ubyte array to write to

void  storeLittleEndian(T)(in T input, ubyte* output);

Store a little-endian ulong

Parameters
T input the input ulong
ubyte* output the ubyte array to write to

void  storeBigEndian(T)(in T input, ubyte* output);

Store a big-endian ulong

Parameters
T input the input ulong
ubyte* output the ubyte array to write to

void  storeLittleEndian(T)(ubyte* output, T x0, T x1);

Store two little-endian words

Parameters
ubyte* output the output ubyte array
T x0 the first word
T x1 the second word

void  storeBigEndian(T)(ubyte* output, T x0, T x1);

Store two big-endian words

Parameters
ubyte* output the output ubyte array
T x0 the first word
T x1 the second word

void  storeLittleEndian(T)(ubyte* output, T x0, T x1, T x2, T x3);

Store four little-endian words

Parameters
ubyte* output the output ubyte array
T x0 the first word
T x1 the second word
T x2 the third word
T x3 the fourth word

void  storeBigEndian(T)(ref ubyte* output, T x0, T x1, T x2, T x3);

Store four big-endian words

Parameters
ubyte* output the output ubyte array
T x0 the first word
T x1 the second word
T x2 the third word
T x3 the fourth word

void  storeLittleEndian(T)(ubyte* output, T x0, T x1, T x2, T x3, T x4, T x5, T x6, T x7);

Store eight little-endian words

Parameters
ubyte* output the output ubyte array
T x0 the first word
T x1 the second word
T x2 the third word
T x3 the fourth word
T x4 the fifth word
T x5 the sixth word
T x6 the seventh word
T x7 the eighth word

void  storeBigEndian(T)(ubyte* output, T x0, T x1, T x2, T x3, T x4, T x5, T x6, T x7);

Store eight big-endian words

Parameters
ubyte* output the output ubyte array
T x0 the first word
T x1 the second word
T x2 the third word
T x3 the fourth word
T x4 the fifth word
T x5 the sixth word
T x6 the seventh word
T x7 the eighth word