This repository was archived by the owner on Feb 29, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
import java .io .*;
2
+ import java .security .MessageDigest ;
3
+ import java .security .*;
2
4
public class compilestandard extends usacotools {
3
-
5
+ public static String sha256 (String input ) throws NoSuchAlgorithmException {
6
+ MessageDigest mDigest = MessageDigest .getInstance ("SHA-256" );
7
+ byte [] result = mDigest .digest (input .getBytes ());
8
+ StringBuffer sb = new StringBuffer ();
9
+ for (int i = 0 ; i < result .length ; i ++) {
10
+ sb .append (Integer .toString ((result [i ] & 0xff ) + 0x100 , 16 ).substring (1 ));
11
+ }
12
+
13
+ return sb .toString ();
14
+ }
4
15
public static void main (String [] args ) throws IOException {
5
16
// TODO Auto-generated method stub
6
17
BufferedReader f ;
@@ -34,6 +45,13 @@ public static void main(String[] args) throws IOException{
34
45
}
35
46
pw .println (text );
36
47
pw .close ();
48
+ print ("utools.java is the one you should copy into your code but usacotools is the one you should extend" );
49
+ try {
50
+ print ("utools.java SHA256: " +sha256 (text ));
51
+ print ("usacotools.java SHA256: " +sha256 (full ));
52
+ }catch (Exception e ) {
53
+ e .printStackTrace ();
54
+ }
37
55
38
56
}
39
57
}
You can’t perform that action at this time.
0 commit comments