1 package civitas.crypto.parameters;
2
3 import java.util.Map;
4
5 import org.springframework.stereotype.Controller;
6
7 import civitas.common.VoteChoice;
8 import civitas.crypto.CryptoException;
9 import civitas.util.CivitasBigInteger;
10
11 @Controller
12 public class DecodeChoice {
13 public VoteChoice apply(final Map<CivitasBigInteger, VoteChoice> map, final CivitasBigInteger m)
14 throws CryptoException {
15 VoteChoice found = map.get(m);
16 if (null == found) {
17 throw new CryptoException("Brute force decoding failed");
18 }
19 return found;
20 }
21 }