Electroneum
Loading...
Searching...
No Matches
crypto.h File Reference
#include <vector>
#include "serialization.h"
#include "debug_archive.h"
#include "crypto/chacha.h"
#include "crypto/crypto.h"
#include "crypto/hash.h"
Include dependency graph for crypto.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<template< bool > class Archive>
bool do_serialize (Archive< false > &ar, std::vector< crypto::signature > &v)
template<template< bool > class Archive>
bool do_serialize (Archive< true > &ar, std::vector< crypto::signature > &v)
 BLOB_SERIALIZER (crypto::chacha_iv)
 BLOB_SERIALIZER (crypto::hash)
 BLOB_SERIALIZER (crypto::hash8)
 BLOB_SERIALIZER (crypto::public_key)
 BLOB_SERIALIZER (crypto::secret_key)
 BLOB_SERIALIZER (crypto::key_derivation)
 BLOB_SERIALIZER (crypto::key_image)
 BLOB_SERIALIZER (crypto::signature)
 VARIANT_TAG (debug_archive, crypto::hash, "hash")
 VARIANT_TAG (debug_archive, crypto::hash8, "hash8")
 VARIANT_TAG (debug_archive, crypto::public_key, "public_key")
 VARIANT_TAG (debug_archive, crypto::secret_key, "secret_key")
 VARIANT_TAG (debug_archive, crypto::key_derivation, "key_derivation")
 VARIANT_TAG (debug_archive, crypto::key_image, "key_image")
 VARIANT_TAG (debug_archive, crypto::signature, "signature")

Function Documentation

◆ BLOB_SERIALIZER() [1/8]

BLOB_SERIALIZER ( crypto::chacha_iv )

◆ BLOB_SERIALIZER() [2/8]

BLOB_SERIALIZER ( crypto::hash )

◆ BLOB_SERIALIZER() [3/8]

BLOB_SERIALIZER ( crypto::hash8 )

◆ BLOB_SERIALIZER() [4/8]

BLOB_SERIALIZER ( crypto::key_derivation )

◆ BLOB_SERIALIZER() [5/8]

BLOB_SERIALIZER ( crypto::key_image )

◆ BLOB_SERIALIZER() [6/8]

BLOB_SERIALIZER ( crypto::public_key )

◆ BLOB_SERIALIZER() [7/8]

BLOB_SERIALIZER ( crypto::secret_key )

◆ BLOB_SERIALIZER() [8/8]

BLOB_SERIALIZER ( crypto::signature )

◆ do_serialize() [1/2]

template<template< bool > class Archive>
bool do_serialize ( Archive< false > & ar,
std::vector< crypto::signature > & v )

Definition at line 44 of file crypto.h.

45{
46 size_t cnt = v.size();
47 v.clear();
48
49 // very basic sanity check
50 if (ar.remaining_bytes() < cnt*sizeof(crypto::signature)) {
51 ar.stream().setstate(std::ios::failbit);
52 return false;
53 }
54
55 v.reserve(cnt);
56 for (size_t i = 0; i < cnt; i++) {
57 v.resize(i+1);
58 ar.serialize_blob(&(v[i]), sizeof(crypto::signature), "");
59 if (!ar.stream().good())
60 return false;
61 }
62 return true;
63}
POD_CLASS signature
Definition crypto.h:108
Here is the caller graph for this function:

◆ do_serialize() [2/2]

template<template< bool > class Archive>
bool do_serialize ( Archive< true > & ar,
std::vector< crypto::signature > & v )

Definition at line 67 of file crypto.h.

68{
69 if (0 == v.size()) return true;
70 ar.begin_string();
71 size_t cnt = v.size();
72 for (size_t i = 0; i < cnt; i++) {
73 ar.serialize_blob(&(v[i]), sizeof(crypto::signature), "");
74 if (!ar.stream().good())
75 return false;
76 }
77 ar.end_string();
78 return true;
79}

◆ VARIANT_TAG() [1/7]

VARIANT_TAG ( debug_archive ,
crypto::hash ,
"hash"  )

◆ VARIANT_TAG() [2/7]

VARIANT_TAG ( debug_archive ,
crypto::hash8 ,
"hash8"  )

◆ VARIANT_TAG() [3/7]

VARIANT_TAG ( debug_archive ,
crypto::key_derivation ,
"key_derivation"  )

◆ VARIANT_TAG() [4/7]

VARIANT_TAG ( debug_archive ,
crypto::key_image ,
"key_image"  )

◆ VARIANT_TAG() [5/7]

VARIANT_TAG ( debug_archive ,
crypto::public_key ,
"public_key"  )

◆ VARIANT_TAG() [6/7]

VARIANT_TAG ( debug_archive ,
crypto::secret_key ,
"secret_key"  )

◆ VARIANT_TAG() [7/7]

VARIANT_TAG ( debug_archive ,
crypto::signature ,
"signature"  )