-
-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
W7DTH is an encryption library for Go, designed to be easy, fast, lightweight, and effective.
You can use “go get” to install W7DTH in your Go project. Make sure you already have a module (go mod). You can download it using the command:
go get -u github.com/simplyYan/W7DTH
The Key function generates a new key or uses an existing one. If “generate” is passed as an argument, a new key is generated. Otherwise, the function expects a hexadecimal string to be passed as the key.
w := w7.New()
key, err := w.Key("generate") // Generates a new key
// OR
key, err := w.Key("existing_hexadecimal_key") // Uses an existing key
The Encrypt function encrypts a string using the key generated or provided in the Key function. It returns the encrypted string.
data := "Hello world"
encryptedData, err := w.Encrypt(data)
The Decrypt function decrypts a string using the key generated or provided in the Key function. It returns the decrypted string.
decryptedData, err := w.Decrypt(encryptedData)
All functions return an error object as the second return value. Always check this error object before proceeding.
key, err := w.Key("generate")
if err != nil {
log.Fatal(err)
}
W7DHT is licensed under BSD-Clause 3 and is open-source.
As W7DTH is completely open-source, you can contribute by adding, improving, or correcting features.