delete in chunks

This commit is contained in:
2026-03-08 23:08:53 +01:00
parent 53a222a7da
commit 7873020e72
3 changed files with 24 additions and 40 deletions

View File

@@ -1,27 +0,0 @@
pkgname=dull-git
pkgver=0.1
pkgrel=1
pkgdesc="Desktop app for securely storing sensitive files"
arch=('x86_64')
url="https://github.com/antpiasecki/dull"
depends=('qt6-base' 'botan')
makedepends=('cmake' 'git')
source=("git+${url}.git")
sha256sums=('SKIP')
options=('!debug')
pkgver() {
cd "${pkgname%-git}"
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
build() {
cd "${pkgname%-git}"
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
cmake --build build -j$(nproc)
}
package() {
cd "${pkgname%-git}/build"
make DESTDIR="${pkgdir}" install
}

View File

@@ -4,7 +4,7 @@ Desktop app for securely storing sensitive files
## Features ## Features
* **Pretty usable UI** * **Pretty usable UI**
* **Overkill encryption:** XChaCha20-Poly1305 + Argon2id(m=1GB,t=6,p=4) key derivation * **Overkill encryption:** XChaCha20-Poly1305 + Argon2id(m=1GB,t=8,p=4) key derivation
* **Cross-platform-ish:** Builds on Linux, Windows and macOS * **Cross-platform-ish:** Builds on Linux, Windows and macOS
* **Drag and Drop support** * **Drag and Drop support**
@@ -21,8 +21,11 @@ cmake --build build -j $(nproc)
### Arch ### Arch
``` ```
sudo pacman -S base-devel sudo pacman -Syu base-devel cmake qt6-base botan
makepkg -si
cmake -S . -B build
cmake --build build -j $(nproc)
./build/dull
``` ```
### Windows (MSYS2) ### Windows (MSYS2)

View File

@@ -143,21 +143,29 @@ void Vault::delete_file(const std::string &filename) {
if (entry_start != -1) { if (entry_start != -1) {
i64 entry_end = entry_start + static_cast<i64>(entry_total_size); i64 entry_end = entry_start + static_cast<i64>(entry_total_size);
i64 read_pos = entry_end;
i64 write_pos = entry_start;
std::array<u8, 65536> buffer{};
while (true) {
m_file.clear(); m_file.clear();
m_file.seekg(entry_end, std::ios::beg); m_file.seekg(read_pos);
std::string remaining; m_file.read(to_char_ptr(buffer.data()), buffer.size());
remaining.assign(std::istreambuf_iterator<char>(m_file), auto bytes = m_file.gcount();
std::istreambuf_iterator<char>()); if (bytes == 0) {
break;
}
m_file.clear(); m_file.seekp(write_pos);
m_file.seekp(entry_start, std::ios::beg); ASSERT(m_file.write(to_char_ptr(buffer.data()), bytes));
ASSERT(m_file.write(remaining.data(), static_cast<i64>(remaining.size())));
read_pos += bytes;
write_pos += bytes;
}
i64 new_size = entry_start + static_cast<i64>(remaining.size());
m_file.flush(); m_file.flush();
m_file.close(); m_file.close();
std::filesystem::resize_file(m_path, new_size); std::filesystem::resize_file(m_path, write_pos);
m_file.open(m_path, std::ios::in | std::ios::out | std::ios::binary); m_file.open(m_path, std::ios::in | std::ios::out | std::ios::binary);
ASSERT(m_file.good()); ASSERT(m_file.good());