CatapultServer  v0.5.0.1 (Elephant)
Base32.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/types.h"
23 #include <string>
24 #include <vector>
25 
26 namespace catapult { namespace utils {
27 
28  const uint32_t Base32_Decoded_Block_Size = 5;
29  const uint32_t Base32_Encoded_Block_Size = 8;
30 
31  // region encode
32 
34  constexpr size_t GetEncodedDataSize(size_t decodedSize) {
36  }
37 
40  bool TryBase32Encode(const RawBuffer& data, const MutableRawString& encodedData);
41 
44  void Base32Encode(const RawBuffer& data, const MutableRawString& encodedData);
45 
47  std::string Base32Encode(const RawBuffer& data);
48 
49  // endregion
50 
51  // region decode
52 
54  constexpr size_t GetDecodedDataSize(size_t encodedSize) {
56  }
57 
60  bool TryBase32Decode(const RawString& encodedData, const MutableRawBuffer& data);
61 
64  void Base32Decode(const RawString& encodedData, const MutableRawBuffer& data);
65 
67  template<size_t N>
68  std::array<uint8_t, N> Base32Decode(const RawString& encodedData) {
69  std::array<uint8_t, N> data;
70  Base32Decode(encodedData, data);
71  return data;
72  }
73 
74  // endregion
75 }}
exceptions.h
catapult::validators::ValidatorContext::Cache
const cache::ReadOnlyCatapultCache & Cache
Catapult cache.
Definition: ValidatorContext.h:62
catapult::Amount
utils::BaseValue< uint64_t, Amount_tag > Amount
Definition: src/catapult/types.h:76
catapult::utils::Base32Encode
void Base32Encode(const RawBuffer &data, const MutableRawString &encodedData)
Definition: Base32.cpp:116
ValidatorContext.h
catapult::validators::ValidationResult
ValidationResult
Enumeration of all possible validation results.
Definition: ValidationResult.h:51
catapult::cache::ReadOnlyAccountStateCache::find
auto find(TKey id) const
Finds the cache value identified by key.
Definition: ReadOnlyArtifactCache.h:85
catapult::model::ResolverContext::resolve
MosaicId resolve(UnresolvedMosaicId mosaicId) const
Resolves mosaic id (mosaicId).
Definition: ResolverContext.cpp:41
catapult::utils::GetDecodedDataSize
constexpr size_t GetDecodedDataSize(size_t encodedSize)
Gets the decoded size of encoded data with size encodedSize.
Definition: Base32.h:54
catapult::observers::DEFINE_OBSERVER
DEFINE_OBSERVER(AccountAddress, model::AccountAddressNotification, [](const auto &notification, const auto &context) { DefaultAccountVisitor visitor(context);visitor.visit(notification.Address);})
catapult::cache::ReadOnlyCatapultCache::sub
const TCache::CacheReadOnlyType & sub() const
Gets a specific sub cache read-only view.
Definition: ReadOnlyCatapultCache.h:35
catapult::utils::Base32_Encoded_Block_Size
const uint32_t Base32_Encoded_Block_Size
Definition: Base32.h:29
DEFINE_STATEFUL_VALIDATOR_WITH_TYPE
#define DEFINE_STATEFUL_VALIDATOR_WITH_TYPE(NAME, NOTIFICATION_TYPE, HANDLER)
Defines a functional stateful validator with NAME around HANDLER for notifications of type NOTIFICATI...
Definition: ValidatorTypes.h:134
catapult::model::BalanceTransferNotification
Notifies a balance transfer from sender to recipient.
Definition: Notifications.h:120
catapult::cache::ReadOnlyAccountStateCache::networkIdentifier
model::NetworkIdentifier networkIdentifier() const
Gets the network identifier.
Definition: ReadOnlyAccountStateCache.cpp:41
catapult::utils::BaseValue
Immutable wrapper for basic types, to provide some type-safety.
Definition: BaseValue.h:100
catapult::utils::MutableRawBuffer
BasicRawBuffer< uint8_t > MutableRawBuffer
A mutable binary buffer.
Definition: RawBuffer.h:65
Validators.h
catapult::validators::ValidatorContext
Contextual information passed to stateful validators.
Definition: ValidatorContext.h:32
Observers.h
catapult::model::FacilityCode::Transfer
Transfer facility code.
CATAPULT_THROW_RUNTIME_ERROR_1
#define CATAPULT_THROW_RUNTIME_ERROR_1(MESSAGE, PARAM1)
Macro used to throw a catapult runtime error with a single parameter.
Definition: exceptions.h:171
catapult::utils::Base32Decode
void Base32Decode(const RawString &encodedData, const MutableRawBuffer &data)
Definition: Base32.cpp:141
catapult::utils::GetEncodedDataSize
constexpr size_t GetEncodedDataSize(size_t decodedSize)
Gets the encoded size of decoded data with size decodedSize.
Definition: Base32.h:34
catapult::validators::BalanceTransferNotification
model::BalanceTransferNotification BalanceTransferNotification
Definition: BalanceValidator.cpp:28
Address.h
catapult::utils::BasicRawBuffer
Basic raw buffer that is composed of a pointer and a size.
Definition: RawBuffer.h:32
catapult::utils::TryBase32Decode
bool TryBase32Decode(const RawString &encodedData, const MutableRawBuffer &data)
Definition: Base32.cpp:137
catapult::utils::Base32_Decoded_Block_Size
const uint32_t Base32_Decoded_Block_Size
Definition: Base32.h:28
catapult::model::PublicKeyToAddress
Address PublicKeyToAddress(const Key &publicKey, NetworkIdentifier networkIdentifier)
Creates an address from a public key (publicKey) for the network identified by networkIdentifier.
Definition: Address.cpp:50
catapult::utils::MutableRawString
A mutable string buffer.
Definition: RawBuffer.h:82
catapult::utils::BasicRawBuffer::Size
size_t Size
Data size.
Definition: RawBuffer.h:58
AccountStateCache.h
catapult::utils::RawString
A const string buffer.
Definition: RawBuffer.h:68
catapult::cache::AccountStateCache
Synchronized cache composed of stateful account information.
Definition: AccountStateCache.h:72
catapult::utils::BasicRawBuffer::pData
T * pData
Data pointer.
Definition: RawBuffer.h:55
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult::validators::ValidationResult::Success
Validation succeeded.
Base32.h
types.h
catapult::validators::ValidatorContext::Resolvers
const model::ResolverContext Resolvers
Alias resolvers.
Definition: ValidatorContext.h:59
catapult::utils::TryBase32Encode
bool TryBase32Encode(const RawBuffer &data, const MutableRawString &encodedData)
Definition: Base32.cpp:112
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::BalanceDebitNotification
Notifies a balance debit by sender.
Definition: Notifications.h:142
catapult::validators::BalanceDebitNotification
model::BalanceDebitNotification BalanceDebitNotification
Definition: BalanceValidator.cpp:29
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::cache::ReadOnlyAccountStateCache
A read-only overlay on top of an account cache.
Definition: ReadOnlyAccountStateCache.h:36
catapult::utils::@1395::DecodeResult
DecodeResult
Definition: Base32.cpp:89
catapult::utils::RawBuffer
BasicRawBuffer< const uint8_t > RawBuffer
A const binary buffer.
Definition: RawBuffer.h:62
catapult::utils::@1395::EncodeResult
EncodeResult
Definition: Base32.cpp:70