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}
31