diff --git a/PKGBUILD b/PKGBUILD deleted file mode 100644 index b685a70..0000000 --- a/PKGBUILD +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/README.md b/README.md index 376d6e2..a98233b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Desktop app for securely storing sensitive files ## Features * **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 * **Drag and Drop support** @@ -21,8 +21,11 @@ cmake --build build -j $(nproc) ### Arch ``` -sudo pacman -S base-devel -makepkg -si +sudo pacman -Syu base-devel cmake qt6-base botan + +cmake -S . -B build +cmake --build build -j $(nproc) +./build/dull ``` ### Windows (MSYS2) diff --git a/src/vault.cc b/src/vault.cc index 2883d57..8840516 100644 --- a/src/vault.cc +++ b/src/vault.cc @@ -143,21 +143,29 @@ void Vault::delete_file(const std::string &filename) { if (entry_start != -1) { i64 entry_end = entry_start + static_cast(entry_total_size); - m_file.clear(); - m_file.seekg(entry_end, std::ios::beg); - std::string remaining; - remaining.assign(std::istreambuf_iterator(m_file), - std::istreambuf_iterator()); + i64 read_pos = entry_end; + i64 write_pos = entry_start; + std::array buffer{}; + while (true) { + m_file.clear(); + m_file.seekg(read_pos); + m_file.read(to_char_ptr(buffer.data()), buffer.size()); + auto bytes = m_file.gcount(); + if (bytes == 0) { + break; + } - m_file.clear(); - m_file.seekp(entry_start, std::ios::beg); - ASSERT(m_file.write(remaining.data(), static_cast(remaining.size()))); + m_file.seekp(write_pos); + ASSERT(m_file.write(to_char_ptr(buffer.data()), bytes)); + + read_pos += bytes; + write_pos += bytes; + } - i64 new_size = entry_start + static_cast(remaining.size()); m_file.flush(); 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); ASSERT(m_file.good());