source: josm/trunk/src/org/tukaani/xz/check/SHA256.java@ 15851

Last change on this file since 15851 was 13350, checked in by stoecker, 7 years ago

see #15816 - add XZ support

File size: 703 bytes
Line 
1/*
2 * SHA256
3 *
4 * Author: Lasse Collin <lasse.collin@tukaani.org>
5 *
6 * This file has been put into the public domain.
7 * You can do whatever you want with this file.
8 */
9
10package org.tukaani.xz.check;
11
12public class SHA256 extends Check {
13 private final java.security.MessageDigest sha256;
14
15 public SHA256() throws java.security.NoSuchAlgorithmException {
16 size = 32;
17 name = "SHA-256";
18 sha256 = java.security.MessageDigest.getInstance("SHA-256");
19 }
20
21 public void update(byte[] buf, int off, int len) {
22 sha256.update(buf, off, len);
23 }
24
25 public byte[] finish() {
26 byte[] buf = sha256.digest();
27 sha256.reset();
28 return buf;
29 }
30}
Note: See TracBrowser for help on using the repository browser.