Hi,
I finally made SecretSharing work. I must be doing something wrong
because the shares size vary everytime I run the program and is always
smaller that the input size. Also, the recovered file is smaller than
the original file, very close in size to the shares.
This is the function I am using:
vector<string> SecretSharePFX(CRYPT_DATA_BLOB *pfx, const char *seed,
int threshold, int nShares)
{
RandomPool rng;
rng.IncorporateEntropy((byte *)seed, strlen(seed));
ChannelSwitch *channelSwitch;
const char *strSource = (const char*)pfx->pbData;
StringSource source(strSource, false, new SecretSharing(rng,
threshold, nShares, channelSwitch = new ChannelSwitch));
string channel;
vector<string> vShares(nShares);
vector_member_ptrs<StringSink> stringSinks(nShares);
for (int i=0; i<nShares; i++)
{
string each;
vShares[i].assign(each);
stringSinks[i].reset(new StringSink(vShares[i]));
channel = WordToString<word32>(i);
stringSinks[i]->Put((byte *)channel.data(), 4);
channelSwitch->AddRoute(channel, *stringSinks[i],
BufferedTransformation::NULL_CHANNEL);
}
source.PumpAll();
return vShares;
}
and a sample function call:
const char* seed = "prueba";
const int threshold = 4;
const int nShares = 6;
vector <string> vPFXShares = SecretSharePFX(pMyPFX, seed, threshold,
nShares);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---