Kagome
Polkadot Runtime Engine in C++17
kagome::crypto::bip39::EntropyAccumulator Class Reference

#include <entropy_accumulator.hpp>

Collaboration diagram for kagome::crypto::bip39::EntropyAccumulator:

Public Member Functions

outcome::result< void > append (const EntropyToken &value)
 append a new entropy token More...
 
outcome::result< std::vector< uint8_t > > getEntropy () const
 
outcome::result< uint8_t > getChecksum () const
 checksum is a part of last byte More...
 
outcome::result< uint8_t > calculateChecksum () const
 calculates checksum of significant bits More...
 

Static Public Member Functions

static outcome::result< EntropyAccumulatorcreate (size_t words_count)
 create class instance More...
 

Private Member Functions

 EntropyAccumulator (size_t bits_count, size_t checksum_bits_count)
 

Private Attributes

std::vector< uint8_t > bits_
 
const size_t total_bits_count_
 
const size_t checksum_bits_count_
 

Detailed Description

provides entropy and checksum

Definition at line 31 of file entropy_accumulator.hpp.

Constructor & Destructor Documentation

kagome::crypto::bip39::EntropyAccumulator::EntropyAccumulator ( size_t  bits_count,
size_t  checksum_bits_count 
)
private
Parameters
bits_counttotal bits count (depends on words count)
checksum_bits_countnumber of bits in checksum byte

Definition at line 88 of file entropy_accumulator.cpp.

Member Function Documentation

outcome::result< void > kagome::crypto::bip39::EntropyAccumulator::append ( const EntropyToken value)

append a new entropy token

Parameters
valuetoken
Returns
success or error if storage is full

Definition at line 67 of file entropy_accumulator.cpp.

outcome::result< uint8_t > kagome::crypto::bip39::EntropyAccumulator::calculateChecksum ( ) const

calculates checksum of significant bits

Returns
checksum value

Definition at line 82 of file entropy_accumulator.cpp.

outcome::result< EntropyAccumulator > kagome::crypto::bip39::EntropyAccumulator::create ( size_t  words_count)
static

create class instance

Parameters
words_countnumber of words in mnemonic phrase

Definition at line 11 of file entropy_accumulator.cpp.

outcome::result< uint8_t > kagome::crypto::bip39::EntropyAccumulator::getChecksum ( ) const

checksum is a part of last byte

Returns
checksum

Definition at line 53 of file entropy_accumulator.cpp.

outcome::result< std::vector< uint8_t > > kagome::crypto::bip39::EntropyAccumulator::getEntropy ( ) const
Returns
entropy as byte array

Definition at line 30 of file entropy_accumulator.cpp.

Member Data Documentation

std::vector<uint8_t> kagome::crypto::bip39::EntropyAccumulator::bits_
private

Definition at line 70 of file entropy_accumulator.hpp.

const size_t kagome::crypto::bip39::EntropyAccumulator::checksum_bits_count_
private

Definition at line 72 of file entropy_accumulator.hpp.

const size_t kagome::crypto::bip39::EntropyAccumulator::total_bits_count_
private

Definition at line 71 of file entropy_accumulator.hpp.


The documentation for this class was generated from the following files: