SHA1 encryption

xiaoxiao2021-03-06  117

For a simple example, this is a function of SHA1 encryption, which can be used to encrypt passwords, and SHA1 encryption is 160-bit hash encryption methods. (The probability of repetition after two different strings encryption is extremely low, which will put small changes in a large change, that is, only one letter, the encrypted result is completely different.)

It is especially suitable for encrypting password: After the encryption, the SHA1 value of the password entered by the user is re-calculated. If the user is stored in the database, it is proved that the user will be successful. The administrator cannot reverate the true password from the SHA1 value seen from the database.

??????? public shared function getsha1code (Original AS String) AS STRING ??????????? Dim HashValue () AS BYTE ??????????? DIM UE AS NEW UnicodeEncoding () ??????????? Dim MessageBytes as Byte () = u.getbytes (Original) ??????????? DIM shhash as new sha1managed () ????? ?????? Hashvalue = shhash.com) ??????????? Dim out asse new stringbuilder (") ??????????? DIM B AS BYTE? ?????????? for Each B in HashValue ??????????????? Out.Append (B. Tnowtring ("X")) ??????? ???? next b ??????????? Return (out.toString ()) ??????? end function

转载请注明原文地址:https://www.9cbs.com/read-125488.html

New Post(0)