scclib
Stable Cloud Computing C++ Library
Public Member Functions | Friends | List of all members
scc::crypto::BitString Class Reference

Bit string. More...

#include <der.h>

Inheritance diagram for scc::crypto::BitString:
Inheritance graph
[legend]

Public Member Functions

uint32_t width () const
 Bit width.
 
uint32_t pad_bits () const
 Number of padding bits (0 bits at the end of the last byte).
 
void width (uint32_t v)
 Set width in bits. More...
 
void set (const std::vector< uint8_t > &v, size_t w)
 Set the bit string from a bit string input. More...
 
void set (const std::vector< char > &v, size_t w)
 
bool is_bit_set (uint32_t bit) const
 Is the bit set? First bit is bit 0.
 
void set_bit (uint32_t bit, bool set=true)
 Set a bit. More...
 
void clear_bit (uint32_t bit)
 Clear a bit.
 
void get (std::vector< uint8_t > &v) const
 Resize and get the vector. More...
 
void get (std::vector< char > &v) const
 

Friends

class DerBitString
 

Detailed Description

Bit string.

A bit string is a sequence of bits, with a bit width.

Examples
scclib/crypto/unittest/der.cc.

Definition at line 81 of file der.h.

Member Function Documentation

◆ get()

void scc::crypto::BitString::get ( std::vector< uint8_t > &  v) const
inline

Resize and get the vector.

Ensures that all padded bits are 0.

Definition at line 154 of file der.h.

◆ set()

void scc::crypto::BitString::set ( const std::vector< uint8_t > &  v,
size_t  w 
)
inline

Set the bit string from a bit string input.

Result will be a bit string of width w, beginning with v.

Examples
scclib/crypto/unittest/der.cc.

Definition at line 114 of file der.h.

◆ set_bit()

void scc::crypto::BitString::set_bit ( uint32_t  bit,
bool  set = true 
)
inline

Set a bit.

First bit is bit 0.

Definition at line 137 of file der.h.

◆ width()

void scc::crypto::BitString::width ( uint32_t  v)
inline

Set width in bits.

Resizes the storage, and pads with 0 bits if necessary.

Definition at line 100 of file der.h.


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