zero-memory 0.2.2
This is a function implementation SecureZeroMemory in D programming language
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
D Zero Memory
This is a function implementation SecureZeroMemory in D programming language.
Fills a block of memory with zeros. SecureZeroMemory is designed to be a more secure version of zero memory function.
Use this function instead of zero memory function when you want to ensure that your data will be overwritten promptly, as some compilers can optimize a call to zero memory function by removing it entirely.
Install
$ dub add zero_memory
Usage example
import zero_memory;
ubyte[] ar = [0, 0, 0, 0, 0];
ubyte[] ar2 = [1, 2, 3, 4, 5];
secureZeroMemory(ar2.ptr, ar2.length);
assert(ar == ar2);
uint[] i = [0, 0, 0, 0, 0 ];
uint[] i2 = [8, 5, 99, 5, 99];
// !!! function secureZeroMemory processes data by byte. Therefore, it is wrong:
secureZeroMemory(i2.ptr, i2.length);
assert(i != i2);
// Need to calculate the length:
secureZeroMemory(i2.ptr, uint.sizeof * i2.length);
assert(i == i2);
// or use a cast to type void[]
i2 = [8, 5, 99, 5, 99];
secureZeroMemory(cast(void[])i2);
assert(i == i2);
License
MIT License
- 0.2.2 released a year ago
- DarkRiDDeR/d-zero-memory
- MIT License
- Copyright (c) 2019-23 DarkRiDDeR, n8sh
- Dependencies:
- none
- Versions:
-
0.2.2 2023-Oct-16 0.2.1 2020-May-24 0.2.0 2020-May-19 0.1.3 2019-Aug-09 0.1.2 2019-Aug-08 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
575 downloads total
-
- Score:
- 1.1
- Short URL:
- zero-memory.dub.pm