Java SHA1 sha12String(MessageDigest messageDigest)

Here you can find the source of sha12String(MessageDigest messageDigest)

Description

sha String

License

Open Source License

Declaration

public static String sha12String(MessageDigest messageDigest) 

Method Source Code

//package com.java2s;
/**********//from   w  ww  .  jav a 2s  . co  m
Copyright ? 2013-2014 Olanto Foundation Geneva
    
   This file is part of myTERM.
    
   myCAT is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
    
myCAT is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
    
You should have received a copy of the GNU Affero General Public License
along with myCAT.  If not, see <http://www.gnu.org/licenses/>.
    
**********/

import java.security.MessageDigest;

import java.util.Formatter;

public class Main {
    public static String sha12String(MessageDigest messageDigest) {
        // Conversion des bytes en   format hex
        try (Formatter formatter = new Formatter()) {
            for (final byte b : messageDigest.digest()) {
                formatter.format("%02x", b);
            }
            return formatter.toString();
        }
    }
}

Related

  1. SHA1(String texto)
  2. sha1(String txt)
  3. sha1(String utf8)
  4. sha1(String value)
  5. sha1(String value)
  6. sha1_b64(final String text)
  7. SHA1_HEX(byte[] bytes)
  8. sha1AsBytes(String input)
  9. sha1ByString(String str)