Blob.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * Blob.h
8  *
9  ****/
10 
11 #pragma once
12 
13 #include <WString.h>
14 
15 namespace Crypto
16 {
20 class Blob
21 {
22 public:
23  Blob(const void* data, size_t size) : data_(data), size_(size)
24  {
25  }
26 
27  Blob(const String& str) : data_(str.c_str()), size_(str.length())
28  {
29  }
30 
31  const uint8_t* data() const
32  {
33  return static_cast<const uint8_t*>(data_);
34  }
35 
36  size_t size() const
37  {
38  return size_;
39  }
40 
41 private:
42  const void* data_;
43  size_t size_;
44 };
45 
49 using Secret = Blob;
50 
51 } // namespace Crypto
Wraps a pointer to some data with size.
Definition: Blob.h:21
const uint8_t * data() const
Definition: Blob.h:31
Blob(const String &str)
Definition: Blob.h:27
size_t size() const
Definition: Blob.h:36
Blob(const void *data, size_t size)
Definition: Blob.h:23
The String class.
Definition: WString.h:137
Definition: Blake2s.h:19
#define str(s)
Definition: testrunner.h:124