29.07.2013 Views

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

EarnedCoin ec = (EarnedCoin) usedCoins.get(new Long(c.getSerialNumber()));<br />

Debugger.debug(getClass(), 1, "EarnedCoin found: " + ec);<br />

Debugger.debug(getClass(), 1, "Numnber<strong>of</strong>Appearances: " +<br />

c.getTransactionlist().numberOfAppearances(cert));<br />

if(ec.earnedTimes - 1 < c.getTransactionlist().numberOfAppearances(cert))<br />

return true;<br />

Debugger.debug(getClass(), 1, "returning false.");<br />

return false;<br />

}<br />

}<br />

}<br />

public Coin getCoinWithSerial(long serial)<br />

{<br />

return((EarnedCoin) usedCoins.get(new Long(serial))).coin;<br />

}<br />

public String toString()<br />

{<br />

String s = "(serialnumber,earned-count) : ";<br />

Enumeration e = usedCoins.elements();<br />

int i = 0;<br />

while(e.hasMoreElements())<br />

{<br />

s += (EarnedCoin) e.nextElement();<br />

if(i < usedCoins.size() - 1)<br />

s += ", ";<br />

i++;<br />

}<br />

return s;<br />

}<br />

private class EarnedCoin implements java.io.Serializable<br />

{<br />

public int earnedTimes;<br />

public Coin coin;<br />

}<br />

public EarnedCoin(Coin coin)<br />

{<br />

this.coin = coin;<br />

earnedTimes = 1;<br />

}<br />

public boolean equals(EarnedCoin ec)<br />

{<br />

return earnedTimes == ec.earnedTimes && this.coin.equals(ec.coin);<br />

}<br />

public String toString()<br />

{<br />

return "(" + coin.getSerialNumber() + "," + earnedTimes + ")";<br />

}<br />

10.2 Currency<br />

10.2.1 BlindedCoin<br />

package <strong>Spam</strong>Cash.Currency;<br />

import org.logi.crypto.sign.BlindFingerprint;<br />

import java.security.interfaces.*;<br />

import org.logi.crypto.keys.RSABlindingFactor;<br />

import org.logi.crypto.sign.Signature;<br />

309

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!