1package eu.siacs.conversations.crypto.sasl;
2
3import com.google.common.hash.HashFunction;
4import com.google.common.hash.Hashing;
5
6import eu.siacs.conversations.entities.Account;
7
8public class ScramSha1 extends ScramMechanism {
9
10 public static final String MECHANISM = "SCRAM-SHA-1";
11
12 public ScramSha1(final Account account) {
13 super(account, ChannelBinding.NONE);
14 }
15
16 @Override
17 protected HashFunction getHMac(final byte[] key) {
18 return (key == null || key.length == 0)
19 ? Hashing.hmacSha1(EMPTY_KEY)
20 : Hashing.hmacSha1(key);
21 }
22
23 @Override
24 protected HashFunction getDigest() {
25 return Hashing.sha1();
26 }
27
28 @Override
29 public int getPriority() {
30 return 20;
31 }
32
33 @Override
34 public String getMechanism() {
35 return MECHANISM;
36 }
37}