I wonder if Sunny King will talk to me about this without DDoSing me off the internet for 3 days? Like he did the last time?
Let's take another shot now that "NovaCoin" has released with the PPCoin difficulty algorithm.
int64 nActualSpacing = (pindexLast->GetBlockTime() - pindexLast->pprev->GetBlockTime());
CBigNum bnPPC;
bnPPC.SetCompact(nPPCBits);
// printf("\n\nBefore: %08x %s\n", bnPPC.GetCompact(), bnPPC.getuint256().ToString().c_str() );
int64 nTargetSpacing = 600;
int64 nInterval = nTargetTimespan / nTargetSpacing;
bnPPC *= ((nInterval - 1) * nTargetSpacing + nActualSpacing + nActualSpacing);
bnPPC /= ((nInterval + 1) * nTargetSpacing);
if (bnPPC > bnProofOfWorkLimit)
bnPPC = bnProofOfWorkLimit;
// printf("PPC : %08x %s\n\n", bnPPC.GetCompact(), bnPPC.getuint256().ToString().c_str());
nPPCBits = bnPPC.GetCompact();
The aboive is the code I used to get PPCoin difficulty on the Bitcoin blockchain. To reduce the amount of data I only printed it to the debug file once every 72 blocks and plotted the result with GNU Octave.
As you can see, your equation
hash rate = difficulty * (2**32) / spacing target
is quite wrong. PPcoin uses the interblock spacing, not the hash rate, to determine its difficulty. In fact, its pretty impossible to know the exact hash rate of a cryptocurrency. Why would you think your own coin uses hash rate in the calculation?