Đang chuẩn bị liên kết để tải về tài liệu:
Storing Data Securely

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Phương pháp CreateHashedPassword tạo ra mật khẩu muối và băm. các mật khẩu tham số là văn bản đơn giản của mật khẩu, tham số existingSalt là muối để sử dụng khi tạo ra phiên bản muối và băm. Nếu muối không tồn tại, chẳng hạn như lần đầu tiên một mật khẩu được lưu trữ, existingSalt nên được thông qua như vô giá trị, và một ngẫu nhiên muối được tạo ra. Một khi bạn có muối, nó được kết hợp với mật khẩu đồng bằng văn bản và băm bằng cách sử dụng lớp SHA512Managed. Giá trị muối sau đó được nối thêm vào. | return pwdNode.InnerText return set XmlNode pwdNode settingsDoc.SelectSingleNode Settings Password string hashedPassword CreateHashedPassword value null if pwdNode null pwdNode.InnerText hashedPassword else XmlNode settingsNode settingsDoc.SelectSingleNode Settings XmlElement pwdElem settingsDoc.CreateElement Password pwdElem.InnerText hashedPassword settingsNode.AppendChild pwdElem _ The CreateHashedPassword method creates the salted and hashed password. The password parameter is the plain text of the password the existingSalt parameter is the salt to use when creating the salted and hashed version. If no salt exists such as the first time a password is stored existingSalt should be passed as null and a random salt will be generated. Once you have the salt it is combined with the plain text password and hashed using the SHA512Managed class. The salt value is then appended to the end of the hashed value and returned. The salt is appended so that when you attempt to validate the password you know what salt was used to create the hashed value. The entire value is then base64-encoded and returned Make a hashed password. private string CreateHashedPassword string password byte existingSalt byte salt null if existingSalt null Make a salt of random size. Create a stronger hash code using RNGCryptoServiceProvider. byte random new byte 1 RNGCryptoServiceProvider rngSize new RNGCryptoServiceProvider Populate with random bytes. rngSize.GetBytes random Convert random bytes to string. Storing Data Securely 679 int size Convert.ToInt32 random Create salt array. salt new byte size Use the better random number generator to get bytes for the salt. RNGCryptoServiceProvider rngSalt new RNGCryptoServiceProvider rngSalt.GetNonZeroBytes salt else salt existingSalt Turn string into bytes. byte pwd Encoding.UTF8.GetBytes password Make storage for both password and salt. byte saltedPwd new byte pwd.Length salt.Length Add pwd bytes first. pwd.CopyTo saltedPwd 0 now add salt salt.CopyTo .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.