first pass is fast for performance, second is crytographically strong

This commit is contained in:
Cristy
2022-06-07 07:27:38 -04:00
parent 20ec4a7c33
commit c1ddb64e57
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -1639,7 +1639,8 @@ MagickPrivate MagickBooleanType ShredMagickMemory(void *memory,
for (j=0; j < length; j+=quantum)
{
SetRandomKey(random_info,quantum,GetStringInfoDatum(key));
if (i != 0)
SetRandomKey(random_info,quantum,GetStringInfoDatum(key));
(void) memcpy(p,GetStringInfoDatum(key),(size_t)
MagickMin(quantum,length-j));
p+=quantum;
+2 -1
View File
@@ -1944,7 +1944,8 @@ MagickPrivate MagickBooleanType ShredFile(const char *path)
break;
for (j=0; j < (MagickOffsetType) length; j+=count)
{
SetRandomKey(random_info,quantum,GetStringInfoDatum(key));
if (i != 0)
SetRandomKey(random_info,quantum,GetStringInfoDatum(key));
count=write(file,GetStringInfoDatum(key),(size_t)
MagickMin((MagickSizeType) quantum,length-j));
if (count <= 0)