Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (let [kraw (kwork/genkey)
- jumbled-key (kwork/jumble kraw)
- index (io/file index-file)
- dump (io/file dump-file)
- index-f (io/file index-final)
- dump-f (io/file dump-final)
- tmp-index (java.io.File/createTempFile "ussa__11_" "90001__"
- (.getParentFile index))
- tmp-dump (java.io.File/createTempFile "ussa__11_" "90001__"
- (.getParentFile dump))]
- [(try
- (do
- (.createNewFile index-f)
- (.createNewFile dump-f)
- (.deleteOnExit index)
- (.deleteOnExit dump)
- (with-open [index-is (io/input-stream index)
- tmpindex-os (io/output-stream tmp-index)]
- (.write tmpindex-os jumbled-key 0 (alength jumbled-key)) ;; write key
- (kwork/encf index-is tmpindex-os kraw) ;; write dump contents
- (.renameTo tmp-index index-f))
- (with-open [dump-is (io/input-stream dump)
- tmpdump-os (io/output-stream tmp-dump)]
- (kwork/encf dump-is tmpdump-os kraw)
- (.renameTo tmp-dump dump-f)))
- )
- (catch Exception e (println (str "EXCEPTION " e))))]
- (do
- (System/gc)
- (.renameTo tmp-index index-f)
- (.renameTo tmp-dump dump-f))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement