got guess function to work for example from book
it calculates (hard coded) the example from the book. Next step is making it take any string, calculate the character frequency and then do the same calculation and print out top answers
This commit is contained in:
@@ -106,7 +106,7 @@ func main() {
|
||||
}
|
||||
|
||||
var vig = &cobra.Command{
|
||||
Use: "vig mode -c [cipher] -k [key] -i [input]",
|
||||
Use: "vig",
|
||||
Short: "vignenere cipher",
|
||||
Long: `perform vigenere cipher`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
@@ -122,6 +122,19 @@ func main() {
|
||||
},
|
||||
}
|
||||
|
||||
var guess = &cobra.Command{
|
||||
Use: "guess",
|
||||
Short: "guess cipher",
|
||||
Long: `will try to guess ceasar cipher`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) < 1 {
|
||||
fmt.Println("missing input, see -h (--help) for more info")
|
||||
os.Exit(1)
|
||||
}
|
||||
psyfer.Guess()
|
||||
},
|
||||
}
|
||||
|
||||
var random = &cobra.Command{
|
||||
Use: "random",
|
||||
Short: "randomly transpose",
|
||||
@@ -236,7 +249,7 @@ func main() {
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{Use: "app"}
|
||||
rootCmd.AddCommand(sub, aes, trans, vig)
|
||||
rootCmd.AddCommand(sub, aes, trans, vig, guess)
|
||||
trans.AddCommand(random, railfence, split)
|
||||
rootCmd.Execute()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user