From 0f2cf9c5bbe61f1b2ebe746bc9afef598d635d3a Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Tue, 24 May 2022 09:03:47 +0200 Subject: [PATCH] improve delete wallet performance by reducing overwrite entropy --- src/main/java/com/sparrowwallet/sparrow/io/IOUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/io/IOUtils.java b/src/main/java/com/sparrowwallet/sparrow/io/IOUtils.java index 12a135e1..39429435 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/IOUtils.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/IOUtils.java @@ -131,13 +131,13 @@ public class IOUtils { if(file.exists()) { long length = file.length(); SecureRandom random = new SecureRandom(); + byte[] data = new byte[64]; + random.nextBytes(data); try(RandomAccessFile raf = new RandomAccessFile(file, "rws")) { raf.seek(0); raf.getFilePointer(); - byte[] data = new byte[64]; int pos = 0; while(pos < length) { - random.nextBytes(data); raf.write(data); pos += data.length; }