otp generation and encryption added with go

This commit is contained in:
lexzach
2024-08-09 14:58:37 -04:00
parent dacdf6dcd3
commit c3cb8eaf83
6 changed files with 160 additions and 0 deletions

33
Go/main.go Normal file
View File

@@ -0,0 +1,33 @@
package main
import (
"fmt"
"flag"
"one-time-pad-utils/otp_gen"
"one-time-pad-utils/otp_encrypt"
)
func main(){
var genpad = flag.Bool("generate", false, "Generate a new One-Time Pad using CSPRNG")
var genpadchunks = flag.Int("chunks", 200, "Specify the amount of chunks to generate")
var encryptmessage = flag.String("encrypt", "", "Specify a message you wish to encrypt")
var decryptmessage = flag.String("decrypt", "", "Specify a message you wish to decrypt")
var otpkey = flag.String("key", "", "The specify required key for encryption and decryption")
var _ = encryptmessage
var _ = decryptmessage
var _ = otpkey
flag.Parse()
if *genpad {
fmt.Printf("%v\n", otpgen.GenerateOTP(*genpadchunks))
return
}
if *encryptmessage != "" {
fmt.Printf("%v\n", otpencrypt.OTPEncrypt(*encryptmessage,*otpkey))
return
}
flag.PrintDefaults()
}