MCPcopy Create free account
hub / github.com/LUX-Core/lux / SecretRecoverFile

Function SecretRecoverFile

src/cryptopp/test.cpp:675–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673}
674
675void SecretRecoverFile(int threshold, const char *outFilename, char *const *inFilenames)
676{
677 CRYPTOPP_ASSERT(threshold >= 1 && threshold <=1000);
678 if (threshold < 1 || threshold > 1000)
679 throw InvalidArgument("SecretRecoverFile: " + IntToString(threshold) + " is not in range [1, 1000]");
680
681 SecretRecovery recovery(threshold, new FileSink(outFilename));
682
683 vector_member_ptrs<FileSource> fileSources(threshold);
684 SecByteBlock channel(4);
685 int i;
686 for (i=0; i<threshold; i++)
687 {
688 fileSources[i].reset(new FileSource(inFilenames[i], false));
689 fileSources[i]->Pump(4);
690 fileSources[i]->Get(channel, 4);
691 fileSources[i]->Attach(new ChannelSwitch(recovery, string((char *)channel.begin(), 4)));
692 }
693
694 while (fileSources[0]->Pump(256))
695 for (i=1; i<threshold; i++)
696 fileSources[i]->Pump(256);
697
698 for (i=0; i<threshold; i++)
699 fileSources[i]->PumpAll();
700}
701
702void InformationDisperseFile(int threshold, int nShares, const char *filename)
703{

Callers 1

CRYPTOPP_API mainFunction · 0.85

Calls 5

IntToStringFunction · 0.85
AttachMethod · 0.80
resetMethod · 0.45
GetMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected