- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileIO.java
More file actions
Latest commit
39 lines (32 loc) · 1.13 KB
/
Copy pathFileIO.java
File metadata and controls
39 lines (32 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
packagePasswordManagerGUI;
importjava.math.BigInteger;
importstaticPasswordManagerGUI.Encryption.*;
publicclassFileIO {
BigIntegerphi;
staticBigIntegerresult;
BigIntegere;
/**
* Function handles logging in and calculating all the necessary values
*
* @param pswd user's password
* @param login user's login
* @return n - part of the RSA
*/
publicStringaddUser(Stringpswd, Stringlogin) {
intadd1 = Math.abs(pswd.hashCode());
intadd2 = Math.abs(login.hashCode());
BigIntegerhpswd = primeLargerThan(BigInteger.valueOf(Math.abs(add1)));
BigIntegerhlogin = primeLargerThan(BigInteger.valueOf(Math.abs(add2)));
phi = getPhi(hpswd, hlogin);
e = getE(phi);
hpswd = hpswd.abs();
hlogin = hlogin.abs();
//System.out.println(hpswd);
//System.out.println(hlogin);
result = hpswd.multiply(hlogin);
//System.out.println("e = "+e);
//System.out.println("phi = "+phi);
//System.out.println("n = "+result);
returnresult.toString();
}
}