Saving Crypto++ objects to std::vector

我的梦境 提交于 2019-12-01 23:17:31

Working implementation of VectorSink

// Written and placed in the public domain by rrmmnn
// Copyright assigned to the Crypto++ project.

namespace CryptoPP {

class VectorSink : public Bufferless<Sink> {
public:

  VectorSink(std::vector<uint8_t>& out)
    : _out(&out) {
  }

  size_t Put2(const byte *inString, size_t length, int /*messageEnd*/, bool /*blocking*/) {
    _out->insert(_out->end(), inString, inString + length);
    return 0;
  }

private:  
  std::vector<uint8_t>* _out;
};

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!