Java SHA1 SHA1(ByteBuffer buf, int offset, int size)

Here you can find the source of SHA1(ByteBuffer buf, int offset, int size)

Description

SHA

License

Open Source License

Declaration

public static byte[] SHA1(ByteBuffer buf, int offset, int size) throws NoSuchAlgorithmException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;
import java.security.*;

public class Main {
    public static byte[] SHA1(byte[] buf) throws NoSuchAlgorithmException {
        MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
        return sha1.digest(buf);
    }//from   ww  w . j  av a 2  s  .co  m

    public static byte[] SHA1(ByteBuffer buf, int offset, int size) throws NoSuchAlgorithmException {
        MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
        for (int i = offset; i < offset + size; i++) {
            sha1.update(buf.get(i));
        }
        return sha1.digest();
    }
}

Related

  1. sha1(byte[] input)
  2. sha1(byte[] input)
  3. sha1(byte[] input)
  4. sha1(byte[] message)
  5. SHA1(byte[] src)
  6. sha1(File f)
  7. sha1(File file)
  8. sha1(File file)
  9. sha1(File sourceFile)