Here you can find the source of computeSHA1(ByteBuffer convertme, int offset, int len)
public static byte[] computeSHA1(ByteBuffer convertme, int offset, int len)
//package com.java2s; /*// w w w . j a v a2 s. c o m * This is the source code of Telegram for Android v. 2.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2015. */ import java.nio.ByteBuffer; import java.security.*; public class Main { public static byte[] computeSHA1(byte[] convertme, int offset, int len) { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(convertme, offset, len); return md.digest(); } catch (Exception e) { //FileLog.e("tmessages", e); } return null; } public static byte[] computeSHA1(ByteBuffer convertme, int offset, int len) { int oldp = convertme.position(); int oldl = convertme.limit(); try { MessageDigest md = MessageDigest.getInstance("SHA-1"); convertme.position(offset); convertme.limit(len); md.update(convertme); return md.digest(); } catch (Exception e) { //FileLog.e("tmessages", e); } finally { convertme.limit(oldl); convertme.position(oldp); } return new byte[0]; } public static byte[] computeSHA1(ByteBuffer convertme) { return computeSHA1(convertme, 0, convertme.limit()); } public static byte[] computeSHA1(byte[] convertme) { return computeSHA1(convertme, 0, convertme.length); } }