Commit 556fb407 authored by vehjelmtvedt's avatar vehjelmtvedt
Browse files

password is hashed when registering

parent 5ed54ee1
No preview for this file type
package inf226.inchat;
import com.lambdaworks.crypto.SCryptUtil;
import inf226.util.immutable.List;
import inf226.util.Pair;
......@@ -17,13 +18,19 @@ public final class Account {
public final Stored<User> user;
public final List<Pair<String,Stored<Channel>>> channels;
public final String password;
// Scrypt parameters
private final int CPUCost = 16384;
private final int memCost = 8;
private final int parallelization = 1;
public Account(final Stored<User> user,
final List<Pair<String,Stored<Channel>>> channels,
final String password) {
this.user = user;
this.channels = channels;
this.password = password;
// Hash password with Scrypt
this.password = SCryptUtil.scrypt(password, CPUCost, memCost, parallelization);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment