This commit is contained in:
Zeev Diukman 2024-09-10 02:53:02 +00:00
parent 63446e91f1
commit 2356f66385
6 changed files with 78 additions and 7 deletions

51
.air.toml Normal file
View file

@ -0,0 +1,51 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
args_bin = []
bin = "./.tmp/main"
cmd = "go build -o ./.tmp/main ."
delay = 1000
exclude_dir = ["assets", ".tmp", "vendor", "testdata",".bkup"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html","mod","work","yaml","json"]
include_file = []
kill_delay = "1s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = false
time = false
[misc]
clean_on_exit = false
[proxy]
app_port = 0
enabled = false
proxy_port = 0
[screen]
clear_on_rebuild = false
keep_scroll = true

View file

@ -2,5 +2,5 @@ go 1.23.0
use ( use (
./ ./
./pkg/crypto ./pkg/zcrypt
) )

24
main.go
View file

@ -1,7 +1,27 @@
package main package main
import "fmt" import (
"fmt"
zcrypt "github.com/zeevdiukman/z/zcrypt"
)
func main() { func main() {
fmt.Println("--== MAIN ==--") key := []byte("your_secret_key")
plaintext := "hello, world!"
encryptedText, err := zcrypt.Encrypt(plaintext, key)
if err != nil {
fmt.Println("Error encrypting:", err)
return
}
decryptedText, err := zcrypt.Decrypt(encryptedText, key)
if err != nil {
fmt.Println("Error decrypting:", err)
return
}
fmt.Println("Encrypted:", encryptedText)
fmt.Println("Decrypted:", decryptedText)
} }

View file

@ -1,3 +0,0 @@
module github.com/zeevdiukman/z/crypto
go 1.23.0

3
pkg/zcrypt/go.mod Normal file
View file

@ -0,0 +1,3 @@
module github.com/zeevdiukman/z/zcrypt
go 1.23.0

View file

@ -1,4 +1,4 @@
package sketch package zcrypt
import ( import (
"crypto/aes" "crypto/aes"