mirror of
https://github.com/github/codeql.git
synced 2025-12-18 18:10:39 +01:00
21 lines
570 B
Java
21 lines
570 B
Java
import java.security.MessageDigest;
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
public class SHA256 implements HASH {
|
|
MessageDigest md;
|
|
public int getBlockSize() {return 32;}
|
|
public void init() throws NoSuchAlgorithmException {
|
|
try { md = MessageDigest.getInstance("SHA-256"); }
|
|
catch (Exception e){
|
|
System.err.println(e);
|
|
}
|
|
}
|
|
|
|
public void update(byte[] foo, int start, int len) throws NoSuchAlgorithmException {
|
|
md.update(foo, start, len);
|
|
}
|
|
|
|
public byte[] digest() throws NoSuchAlgorithmException {
|
|
return md.digest();
|
|
}
|
|
} |