-
-
Notifications
You must be signed in to change notification settings - Fork 3
Password Example
Andrew Lambert edited this page Nov 26, 2022
·
8 revisions
Use the Password class to securely hash, verify, and derive cryptographic keys from password data.
Dim pw As libsodium.Password = "seekrit"
Dim pw As libsodium.Password = "seekrit"
Dim hash As String = pw.GenerateHash()
Dim pw As libsodium.Password = "seekrit"
Dim hash As String = pw.GenerateHash() ' the hash from (e.g.) the database, generated here for the example
If Not pw.VerifyHash(hash) Then MsgBox("Bad password!")
Generate a new signing key pair from a password
A key for use in message signatures.
Dim pw As libsodium.Password = "seekrit"
Dim key As New libsodium.PKI.SigningKey(pw, pw.RandomSalt, libsodium.ResourceLimits.Interactive)
Generate a new encryption key pair from a password
A key for use in asymmetric encryption.
Dim pw As libsodium.Password = "seekrit"
Dim key As New libsodium.PKI.EncryptionKey(pw, pw.RandomSalt, libsodium.ResourceLimits.Interactive)
Generate a new secret key from a password
A key for use in symmetric encryption and message authentication.
Dim pw As libsodium.Password = "seekrit"
Dim key As New libsodium.SKI.SecretKey(pw, pw.RandomSalt, libsodium.ResourceLimits.Interactive)
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2016-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.