libcryfs/src/blockstore/interface/helpers/BlockStoreWithRandomKeys.cpp

20 lines
486 B
C++
Raw Normal View History

2014-12-09 17:19:59 +01:00
#include <blockstore/interface/helpers/BlockStoreWithRandomKeys.h>
#include <blockstore/utils/RandomKeyGenerator.h>
using namespace blockstore;
using std::string;
BlockWithKey BlockStoreWithRandomKeys::create(size_t size) {
std::unique_ptr<BlockWithKey> result;
do {
result = create(_generateRandomKey(), size);
} while (!result);
return std::move(*result);
}
string BlockStoreWithRandomKeys::_generateRandomKey() {
return RandomKeyGenerator::singleton().create();
}