用python或ruby编写文件粉碎机? [英] Writing a file shredder in python or ruby?

查看:57
本文介绍了用python或ruby编写文件粉碎机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在学习 python 和/或 ruby​​ 的过程中,我想知道如何实现文件粉碎机?我希望它接受一个文件作为参数,然后使用一种算法使该文件不可恢复.以后可能会添加对多个文件甚至整个目录的支持.

In the effort to learn python and/or ruby, I was wondering how a file shredder would be implemented? I would like it to take in a file as an argument and then employ an algorithm to make that file unrecoverable. Would possibly add the support for multiple files or even whole directories later.

推荐答案

正如一个警告,碎纸机在现代系统上通常会有不同程度的成功,这要归功于日志、写时复制文件系统、磨损均衡(闪存),以及现代系统中使用的其他技术.可能想查看维基百科,了解一些陷阱.

Just as a warning, shredders generally will have varying levels of success on modern systems, thanks to journals, copy-on-write file systems, wear leveling (flash), and other techniques used in modern system. Might wanna check out wikipedia on some of the pitfalls.

简而言之,您需要能够直接在当前现有数据之上写入.有几种不同安全级别的不同模式,但通常如果你用随机数据覆盖文件大约 25 次(四舍五入到下一个块大小),文件应该是完全不可恢复的(至少是数据的副本).还有其他技术可以在更少的次数中安全地覆盖它(3 次,随机,1,然后零也可以很好地工作).

In short, you'd need to be able to write directly on top of the currently existing data. There's a few different patterns of varying levels of security, but often if you overwrite the file about 25 times with random data (rounding up to the next block size) the file should be completely unrecoverable (at least that copy of the data). There are other techniques that can securely overwrite it in less passes (3 passes, random, ones, then zeros also works decently well).

这篇关于用python或ruby编写文件粉碎机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆