Java SHA256 java.security.MessageDigest を使う場合
結果として取得できる byte[] を、どういうHEX文字列にすべきか?
String.format を使う手段もあるが、BigInteger の toString で16進を指定する手もある、
try{ byte[] hashbytes = MessageDigest.getInstance("SHA-256").digest(string.getBytes()); BigInteger hashInt = new BigInteger(1, hashbytes); String hashString = hashInt.toString(16); }catch (NoSuchAlgorithmException e){ e.printStackTrace(); }