if (salt.length != sha1.getDigestLength())
throw new IllegalArgumentException("Salt has wrong length (" + salt.length + ")");
HMAC hmac = new HMAC(sha1, salt, salt.length);
hmac.update(StringEncoder.GetBytes(hostname));
byte[] dig = new byte[hmac.getDigestLength()];
hmac.digest(dig);