-
Notifications
You must be signed in to change notification settings - Fork 0
/
wavSteg.go
46 lines (38 loc) · 976 Bytes
/
wavSteg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"flag"
"log"
"os"
"github.com/ImTheCurse/wavSteg/Decode"
"github.com/ImTheCurse/wavSteg/encode"
)
func main() {
audioFileName := flag.String("audio", "", "Audio file name")
isEncode := flag.Bool("encode", false, "Encode flag")
isDecode := flag.Bool("decode", true, "Decode flag")
textFileName := flag.String("tfile", "", "Encode message with provided text file name")
cliMessage := flag.String("message", "", "Encode message with Command Line Interface message")
flag.Parse()
var message string
fp, err := os.Open(*audioFileName)
if err != nil {
log.Fatal("invalid audio file name")
}
if *textFileName != "" {
textBytes, err := os.ReadFile(*textFileName)
if err != nil {
log.Fatal("invalid text file name")
}
message = string(textBytes)
}
if *cliMessage != "" {
message = *cliMessage
}
if *isEncode {
encode.EncodeAudio(fp, message)
*isDecode = false
}
if *isDecode {
Decode.Decode("enc_file.wav")
}
}