Browse Source

Add deinit to Scrypt to deallocate salsaBlock memory

Ensures proper memory management by freeing salsaBlock during Scrypt deinitialization.
Marcin Krzyzanowski 6 days ago
parent
commit
e3ee021679
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Sources/CryptoSwift/Scrypt.swift

+ 4 - 0
Sources/CryptoSwift/Scrypt.swift

@@ -67,6 +67,10 @@ public final class Scrypt {
     self.dkLen = dkLen
   }
 
+  deinit {
+    salsaBlock.deallocate()
+  }
+
   /// Runs the key derivation function with a specific password.
   public func calculate() throws -> [UInt8] {
     // Allocate memory (as bytes for now) for further use in mixing steps