mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
improve delete wallet performance by reducing overwrite entropy
This commit is contained in:
parent
2c1f7e181c
commit
0f2cf9c5bb
1 changed files with 2 additions and 2 deletions
|
@ -131,13 +131,13 @@ public class IOUtils {
|
||||||
if(file.exists()) {
|
if(file.exists()) {
|
||||||
long length = file.length();
|
long length = file.length();
|
||||||
SecureRandom random = new SecureRandom();
|
SecureRandom random = new SecureRandom();
|
||||||
|
byte[] data = new byte[64];
|
||||||
|
random.nextBytes(data);
|
||||||
try(RandomAccessFile raf = new RandomAccessFile(file, "rws")) {
|
try(RandomAccessFile raf = new RandomAccessFile(file, "rws")) {
|
||||||
raf.seek(0);
|
raf.seek(0);
|
||||||
raf.getFilePointer();
|
raf.getFilePointer();
|
||||||
byte[] data = new byte[64];
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
while(pos < length) {
|
while(pos < length) {
|
||||||
random.nextBytes(data);
|
|
||||||
raf.write(data);
|
raf.write(data);
|
||||||
pos += data.length;
|
pos += data.length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue