This repository was archived by the owner on Feb 29, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompilestandard.java
More file actions
Latest commit
57 lines (50 loc) · 1.64 KB
/
Copy pathcompilestandard.java
File metadata and controls
57 lines (50 loc) · 1.64 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
importjava.io.*;
importjava.security.MessageDigest;
importjava.security.*;
publicclasscompilestandardextendsusacotools {
publicstaticStringsha256(Stringinput) throwsNoSuchAlgorithmException {
MessageDigestmDigest = MessageDigest.getInstance("SHA-256");
byte[] result = mDigest.digest(input.getBytes());
StringBuffersb = newStringBuffer();
for (inti = 0; i < result.length; i++) {
sb.append(Integer.toString((result[i] & 0xff) + 0x100, 16).substring(1));
}
returnsb.toString();
}
publicstaticvoidmain(String[] args) throwsIOException{
// TODO Auto-generated method stub
BufferedReaderf;
if(args.length==1) {
if(args[0].equals("eclipse")) {
f=mreader("src/usacotools.java");
}else {
f=mreader("usacotools.java");
}
}else {
f=mreader("usacotools.java");
}
print("build");
Stringst;
Stringfull="";
while ((st = f.readLine()) != null) {
full=full+st+"\n";
}
Stringtext=full.replace("if(!(lock)) {return null;}", "");
text=text.replace("public abstract class usacotools","public abstract class utools");
print(text);
PrintWriterpw=mwriter("utools.java");
if(args[0].equals("eclipse")) {
pw=mwriter("src/utools.java");
}else {
}
pw.println(text);
pw.close();
print("utools.java is the one you should copy into your code but usacotools is the one you should extend");
try{
print("utools.java SHA256: "+sha256(text));
print("usacotools.java SHA256: "+sha256(full));
}catch(Exceptione) {
e.printStackTrace();
}
}
}