The contents of the chapter:
This section mainly explains the use of MD5 and Npoi,
How to use the two technologies in your project.
----------------------------------------------------------------------------------------
MD5 algorithm: is a hash (hash) algorithm (digest algorithm, fingerprint algorithm), not a pure compression algorithm, not a
Encryption algorithm (error-prone). Any content of any length can be computed with MD5 hash value.
MD5 length is generally 32-bit 16 binary numeric string, the number of MD5 values is limited, but the source data is infinite,
Therefore, the probability of generating the same MD5 value with different content is stored, because the MD5 algorithm is irreversible, even if the MD5 value corresponding to the content is obtained,
The content cannot be pushed back by the MD5 value. However, the probability of generating the same MD5 value for different content is very very low.
The password field holds the MD5 value of the user's input password so that the system administrator, the hacker, does not know what the user's password is,
Also avoids the problem that the user's other system password is exploited.
The method of judging correctness: calculates the MD5 value of the password entered by the user, compares it with the MD5 value stored in the database, if
Equality is considered to be the correct password.
Common application: Calculates the MD5 value of a file to verify that the file has been tampered with.
The password of the website can only be reset and the original password cannot be retrieved.
---------------------------------------------------------------------------------------------
The MD5 algorithm is theoretically irreversible.
To be more secure: Count two times the MD5 value, or add a fixed string.
Similar to MD5, there are algorithms such as SHA.
---------------------------------------------------------------------------------
Npoi reading Excel files
An Excel file-"Workbook has a lot of pages-" Sheet,
There are many lines in each page-"row, there are many cells in each row-" cell
Strings that look like numbers start with a half-width single quote.
Add references;
using (Stream fs = new FileStream ("Myexcel.xls", FileMode.Open, FileAccess.Read)) {//create sheet Iworkbook workbook = new Hssfworkbook (FS); Gets the page var sheet = workbook. Getsheetat (0 ); Traverse the row for (var i = 0; I <= sheet. Lastrownum; i++ ) {var row = sheet. GetRow (i); Traverse cell var sb = new StringBuilder (); for (var j = 0; J < row. Lastcellnum; J + + ) {var cell = row. Getcell (j); if (cell. Celltype = = celltype.numeric) {sb. Append (cell. Numericcellvalue + ""); The cell's Data } if (cell. Celltype = = celltype.string) {sb. Append (cell. Stringcellvalue + ""); Cell Data }}//end for J Console.WriteLine (sb.) ToString ()); }//end for I Console.WriteLine (sheet. SheetName); Console.readkey (); }//end using
such as Peng Network: http://www.rupeng.com
such as Peng Network. NET three-tier architecture chapter III MD5 and NPOI use