Botan

Buffered Computation

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

interface  BufferedComputation;

This class represents any kind of computation which uses an internal state, such as hash functions or MACs


final void  update(in ubyte[] input);

Add new input to process.

Parameters
ubyte[] input the input to process as a ubyte array

final void  update(const(ubyte)* input, size_t length);

Add new input to process.

Parameters
const(ubyte)* input the input to process as a ubyte array
size_t length of param in in bytes

final void  update(T, ALLOC)(auto ref const RefCounted!(Vector!(T, ALLOC)) input);

Add new input to process.

Parameters
RefCounted!(Vector!(T, ALLOC)) input the input to process as a reference type

final void  update(T, ALLOC)(auto ref const Vector!(T, ALLOC) input);

Add new input to process.

Parameters
Vector!(T, ALLOC) input the input to process as a Vector

final void  updateBigEndian(T)(in T input);

Add an integer in big-endian order

Parameters
T input the value

final void  update(in string str);

Add new input to process.

Parameters
string str The input to process as a string.
Notes:
Will be interpreted as a ubyte array based on the strings encoding.

final void  update(ubyte input);

Process a single ubyte.

Parameters
ubyte input the ubyte to process

final void  flushInto(ref ubyte[] output);

Complete the computation and retrieve the final result.

Parameters
ubyte[] output The ubyte array to be filled with the result.
Notes:
Must be of length outputLength()

final void  flushInto(ubyte* output);

Complete the computation and retrieve the final result.

Parameters
ubyte* output The ubyte array to be filled with the result.
Notes:
Must be of length outputLength()

final SecureVector!ubyte  finished();

Complete the computation and retrieve the final result.

Returns
SecureVector holding the result

final SecureVector!ubyte  process(in ubyte[] input);

Update and finalize computation. Does the same as calling update() and finished() consecutively.

Parameters
ubyte[] input the input to  process as a ubyte array
Returns
The result of the call to finished()

final SecureVector!ubyte  process(const(ubyte)* input, size_t length);

Update and finalize computation. Does the same as calling update() and finished() consecutively.

Parameters
const(ubyte)* input the input to  process as a ubyte array
size_t length the length of the ubyte array
Returns
The result of the call to finished()

final SecureVector!ubyte  process(ALLOC)(auto ref const RefCounted!(Vector!(ubyte, ALLOC), ALLOC) input);

Update and finalize computation. Does the same as calling update() and finished() consecutively.

Parameters
RefCounted!(Vector!(ubyte, ALLOC), ALLOC) input the input to  process
Returns
The result of the call to finished()

final SecureVector!ubyte  process(ALLOC)(auto ref const Vector!(ubyte, ALLOC) input);

Update and finalize computation. Does the same as calling update() and finished() consecutively.

Parameters
Vector!(ubyte, ALLOC) input the input to  process
Returns
The result of the call to finished()

final SecureVector!ubyte  process(in string input);

Update and finalize computation. Does the same as calling update() and finished() consecutively.

Parameters
string input the input to  process as a string
Returns
The result of the call to finished()

abstract const @property size_t  outputLength();

Returns
Length of the output of this function in bytes

protected abstract void  addData(const(ubyte)* input, size_t length);

Add more data to the computation

Parameters
const(ubyte)* input is an input buffer
size_t length is the length of input in bytes

protected abstract void  finalResult(ubyte* output);

Write the final output to out

Parameters
ubyte* output An output buffer of size outputLength()