加密随机访问文件 [英] Encryption of a Random Access File

查看:97
本文介绍了加密随机访问文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能指出我可以用来加密和解密随机存取文件中的数据的强大算法吗?



我需要能够更新条目而不用必须重写整个文件,只读取我需要的部分;我认为这可以排除很多流密码。

Can anyone point me to a strong algorithm I can use to encrypt and decrypt data in a random access file?

I need to be able to update entries without having to rewrite the whole file and only read the parts that I need; I think this could exclude a lot of stream cyphers.

推荐答案

请看我对这个问题的评论。



想法是:您需要修改文件的结构。它可以由一组加密的片段组成。对于随机访问,使用固定大小(加密形式)片段会很好,但加密算法非常适合。这样,您可以在片段上查找文件位置并将其解密,修改并写入同一位置。如果你这样做,我强烈建议使用二进制形式;它会简单得多。



-SA
Please see my comment to the question.

The idea is: you need to modify the structure of your file. It can be composed of the set of encrypted fragment. For random access, it would be good to have fixed-size (in encrypted form) fragments, but encrypted algorithms are well suited for that. This way, you can seek the file position on a fragment and decrypt it all, modify and write to the same place. If you do it, I would highly recommend to use binary form; it would be much simpler.

—SA


这篇关于加密随机访问文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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