Log logs using sequence deserialization encryption (serializer) Descrypto encryption

Source: Internet
Author: User

If you encrypt a file content once, the contents of the file will not be updated, most of the serialized anti-sequence encryption program on the Internet is no problem.

1: Because the log file will update the content at any time, the online program is not feasible. Need to make changes

If you want to open txt, the using (var file =new FileStream (path,filemode.append)) simply expands the Append command, and the result is that the new additions will not be displayed.

or two different periods written in the middle of the content of the log is random, because the file mode is append, the extension of the new line, this command is two paragraphs of text with a line break, the specific addition of the symbol did not go to test.

Use this using (var file =new FileStream (path,filemode.openorcreate)) to open or generate the pattern.

2: The program to use the list content to add to the document, each time the data is stored, the contents of the log file, deserialized, converted into a list

IFormatter serializer=new BinaryFormatter ();
var obj = serializer.deserialize (crstream) as list<string>;

The added content is then put into the list, which is serialized into the list object. Complete the operation, and this method resolves the problem.

Another way is to get rid of the serialization, generate a cipher string each time and then deposit txt, read one line at a time, compile one line. This method, the mixing degree does not have the upper method good.

Log logs using sequence deserialization encryption (serializer) Descrypto encryption

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.