Here you can find the source of SHA256Binary(String toHash)
Parameter | Description |
---|---|
toHash | The String to hash using SHA256 |
private static String SHA256Binary(String toHash)
//package com.java2s; /*/*from w ww . j av a2 s . c om*/ * SigmaX 1.0.0b1 Source Code * Copyright (c) 2016 Curecoin Developers * Distributed under MIT License * Requires Apache Commons Library * Supports Java 1.7+ */ import java.security.*; import java.math.*; public class Main { private static MessageDigest md; /** * This SHA256 function returns a 256-character binary String representing the full SHA256 hash of the String toHash * This binary String is useful when signing a message with a Lamport Signature. * * @param toHash The String to hash using SHA256 * * @return String The binary String representing the entire SHA256 hash of toHash */ private static String SHA256Binary(String toHash) { try { byte[] messageHash = md.digest(toHash.getBytes("UTF-8")); return new BigInteger(1, messageHash).toString(2); } catch (Exception e) { e.printStackTrace(); } return null; } }