From ed21b70ba2f2e5f7154e6c03a5a771fdfae1e732 Mon Sep 17 00:00:00 2001 From: Henry Varona Date: Thu, 1 Dec 2016 17:03:23 -0430 Subject: [PATCH] importing file --- src/main/java/com/luminiasoft/bitshares/FileBin.java | 4 +++- src/main/java/com/luminiasoft/bitshares/Test.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/luminiasoft/bitshares/FileBin.java b/src/main/java/com/luminiasoft/bitshares/FileBin.java index 37306f2..9e29bdb 100644 --- a/src/main/java/com/luminiasoft/bitshares/FileBin.java +++ b/src/main/java/com/luminiasoft/bitshares/FileBin.java @@ -54,8 +54,10 @@ public abstract class FileBin { ECKey randomECKey = ECKey.fromPublicOnly(publicKey); byte[] finalKey = randomECKey.getPubKeyPoint().multiply(ECKey.fromPrivate(md.digest(password.getBytes("UTF-8"))).getPrivKey()).normalize().getXCoord().getEncoded(); - + MessageDigest md1 = MessageDigest.getInstance("SHA-512"); + finalKey = md1.digest(finalKey); rawData = decryptAES(rawData, byteToString(finalKey).getBytes()); + byte[] checksum = new byte[4]; System.arraycopy(rawData, 0, checksum, 0, 4); byte[] compressedData = new byte[rawData.length-4]; diff --git a/src/main/java/com/luminiasoft/bitshares/Test.java b/src/main/java/com/luminiasoft/bitshares/Test.java index 02a25de..f010b9e 100644 --- a/src/main/java/com/luminiasoft/bitshares/Test.java +++ b/src/main/java/com/luminiasoft/bitshares/Test.java @@ -731,6 +731,6 @@ public class Test { public void testCreateBinFile(){ byte[] fileOutput = FileBin.getBytesFromBrainKey(Main.BRAIN_KEY, "123456","bithon-83"); - System.out.println("fileOutput " + Arrays.toString(fileOutput)); + System.out.println(FileBin.getBrainkeyFromByte(fileOutput, "123456")); } }