/** * */ package anoncard; /** * @author christoph * */ public class User { /** * The encoded username (should be the byte representation of a readable * string) */ private byte[] username; /** * The password (should be a PIN number) */ private byte[] password; /** * * @param username * @param password */ public User(byte[] username, byte[] password) { super(); this.username = username; this.password = password; } /** * @return the password */ public byte[] getPassword() { return password; } /** * @param password * the password to set */ public void setPassword(byte[] password) { this.password = password; } /** * @return the username */ public byte[] getUsername() { return username; } /** * Returns a new user object with the same values inside. * * @return */ public User getCopy() { return new User(Arrays.copyOf(username), Arrays.copyOf(password)); } /** * Returns true, iff username==username AND password==password * * @param user * @return */ public boolean equals(User user) { if (user == null) { return false; } return Arrays.arrayEqual(username, user.getUsername()) && Arrays.arrayEqual(password, user.getPassword()); } }