libzypp  17.14.0
zypp::base::DrunkenBishop Class Reference

Random art fingerprint visualization Visualize fingerprint data on a [17x9] (SSH) or [19x11] (GPG) or custom sized board. More...

#include <DrunkenBishop.h>

Classes

class  Impl
 DrunkenBishop implementation. More...
 

Public Types

enum  OptionBits { USE_COLOR = (1<<0) }
 

Public Member Functions

 DrunkenBishop ()
 Default ctor: empty board (1x1) More...
 
 DrunkenBishop (const std::string &data_r, const std::string &title_r=std::string())
 Ctor taking a data string (and optional title) and using a default (SSH/GPG) board. More...
 
 DrunkenBishop (const std::string &data_r, const std::string &title_r, unsigned height_r)
 Ctor also taking a desired board height (even value is incremented, width is 2*height-1). More...
 
 DrunkenBishop (const std::string &data_r, unsigned height_r)
 Ctor. More...
 
 DrunkenBishop (const std::string &data_r, const std::string &title_r, unsigned height_r, unsigned width_r)
 Ctor also taking a desired board height and width (even values are incremented). More...
 
 DrunkenBishop (const std::string &data_r, unsigned height_r, unsigned width_r)
 Ctor. More...
 
 ~DrunkenBishop ()
 Dtor. More...
 
 ZYPP_DECLARE_FLAGS (Options, OptionBits)
 
std::ostream & dumpOn (std::ostream &str, Options options_r=Options()) const
 Render board to steam. More...
 
std::ostream & dumpOn (std::ostream &str, const std::string &prefix_r, Options options_r=Options()) const
 
std::string asString (Options options_r=Options()) const
 Render board as string. More...
 
std::string asString (const std::string &prefix_r, Options options_r=Options()) const
 
std::vector< std::string > asLines (Options options_r=Options()) const
 Render to an array of lines. More...
 
std::vector< std::string > asLines (const std::string &prefix_r, Options options_r=Options()) const
 

Private Attributes

RW_pointer< Impl_pimpl
 Implementation class. More...
 

Friends

std::ostream & operator<< (std::ostream &str, const DrunkenBishop &obj)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const DrunkenBishop &obj)
 

Detailed Description

Random art fingerprint visualization Visualize fingerprint data on a [17x9] (SSH) or [19x11] (GPG) or custom sized board.

The default board size and layout depends on the data string length (above 32 the GPG board and layout is used).

The data string should be an even sized HEX string, otherwise it will be 0-padded.

All ctor calls may throw std::invalid_argument.

[SuSE Package Signing Key <build@suse.de>]
+------[Title]------+
| . . ^ | fpr FEAB502539D846DB2C0961CA70AF9E8139DB7C82
| : : . | id 70AF9E8139DB7C82
| ^ ^ . | cre 1481108255 Wed Dec 7 11:57:35 2016
| ^ . l i | exp 1607252255 Sun Dec 6 11:57:35 2020
| : ^ . f : | ttl 992
| ? ^ .Sl | rpm 39db7c82-5847eb1f
| E i ... |
| ^ .. |
| . . |
| . . |
| .... |
+----[39DB7C82]-----+

Based on https://github.com/atoponce/keyart, the development location for the Debian signing-party package. We try to use the same charset and heatmap. See also http://dirk-loss.de/sshvis/drunken_bishop.pdf.

Definition at line 61 of file DrunkenBishop.h.

Member Enumeration Documentation

◆ OptionBits

Enumerator
USE_COLOR 

use colors

Definition at line 91 of file DrunkenBishop.h.

Constructor & Destructor Documentation

◆ DrunkenBishop() [1/6]

zypp::base::DrunkenBishop::DrunkenBishop ( )

Default ctor: empty board (1x1)

Definition at line 369 of file DrunkenBishop.cc.

◆ DrunkenBishop() [2/6]

zypp::base::DrunkenBishop::DrunkenBishop ( const std::string &  data_r,
const std::string &  title_r = std::string() 
)

Ctor taking a data string (and optional title) and using a default (SSH/GPG) board.

Definition at line 373 of file DrunkenBishop.cc.

◆ DrunkenBishop() [3/6]

zypp::base::DrunkenBishop::DrunkenBishop ( const std::string &  data_r,
const std::string &  title_r,
unsigned  height_r 
)

Ctor also taking a desired board height (even value is incremented, width is 2*height-1).

Definition at line 377 of file DrunkenBishop.cc.

◆ DrunkenBishop() [4/6]

zypp::base::DrunkenBishop::DrunkenBishop ( const std::string &  data_r,
unsigned  height_r 
)
inline

Ctor.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 75 of file DrunkenBishop.h.

◆ DrunkenBishop() [5/6]

zypp::base::DrunkenBishop::DrunkenBishop ( const std::string &  data_r,
const std::string &  title_r,
unsigned  height_r,
unsigned  width_r 
)

Ctor also taking a desired board height and width (even values are incremented).

Definition at line 381 of file DrunkenBishop.cc.

◆ DrunkenBishop() [6/6]

zypp::base::DrunkenBishop::DrunkenBishop ( const std::string &  data_r,
unsigned  height_r,
unsigned  width_r 
)
inline

Ctor.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 82 of file DrunkenBishop.h.

◆ ~DrunkenBishop()

zypp::base::DrunkenBishop::~DrunkenBishop ( )

Dtor.

Definition at line 385 of file DrunkenBishop.cc.

Member Function Documentation

◆ ZYPP_DECLARE_FLAGS()

zypp::base::DrunkenBishop::ZYPP_DECLARE_FLAGS ( Options  ,
OptionBits   
)

◆ dumpOn() [1/2]

std::ostream& zypp::base::DrunkenBishop::dumpOn ( std::ostream &  str,
Options  options_r = Options() 
) const
inline

Render board to steam.

Definition at line 97 of file DrunkenBishop.h.

◆ dumpOn() [2/2]

std::ostream & zypp::base::DrunkenBishop::dumpOn ( std::ostream &  str,
const std::string &  prefix_r,
Options  options_r = Options() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 388 of file DrunkenBishop.cc.

◆ asString() [1/2]

std::string zypp::base::DrunkenBishop::asString ( Options  options_r = Options()) const
inline

Render board as string.

Definition at line 103 of file DrunkenBishop.h.

◆ asString() [2/2]

std::string zypp::base::DrunkenBishop::asString ( const std::string &  prefix_r,
Options  options_r = Options() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 391 of file DrunkenBishop.cc.

◆ asLines() [1/2]

std::vector<std::string> zypp::base::DrunkenBishop::asLines ( Options  options_r = Options()) const
inline

Render to an array of lines.

Definition at line 109 of file DrunkenBishop.h.

◆ asLines() [2/2]

std::vector< std::string > zypp::base::DrunkenBishop::asLines ( const std::string &  prefix_r,
Options  options_r = Options() 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 398 of file DrunkenBishop.cc.

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  str,
const DrunkenBishop obj 
)
friend

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  str,
const DrunkenBishop obj 
)
related

Stream output

Definition at line 123 of file DrunkenBishop.h.

Member Data Documentation

◆ _pimpl

RW_pointer<Impl> zypp::base::DrunkenBishop::_pimpl
private

Implementation class.

Pointer to implementation.

Definition at line 115 of file DrunkenBishop.h.


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