package main import ( "fmt" "alex/grasshopper" ) func main() { var test_K = [32]uint8 { 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef } var test_PT = [16]uint8 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88 } var example_K = [32]uint8 { 0x17, 0x19, 0xca, 0xfe, 0x0c, 0x10, 0x03, 0x15, 0x2d, 0x19, 0x27, 0x13, 0x07, 0xab, 0x71, 0x67, 0x1f, 0xe9, 0xa7, 0x31, 0x87, 0x15, 0x78, 0x61, 0x65, 0x03, 0x01, 0xef, 0x4a, 0xec, 0x9f, 0xf3 } var example_PT = [16]uint8 { 'S','e','a','r','c','h',' ','t','h','e',' ','s','h','i','p','.' } grasshopper.InitCipher() fmt.Println("Encryption test.") fmt.Printf("Key:\n %x\n(1) Plain text: %x\n", test_K, test_PT) test_CT := grasshopper.Encrypt(test_K,test_PT) fmt.Printf("(1) Cipher text: %x\n", test_CT) test_2PT := grasshopper.Decrypt_L(test_K,test_CT) fmt.Printf("(1.1) Plain text: %x\n", test_2PT) test_3PT := grasshopper.Decrypt(test_K,test_CT) fmt.Printf("(1.2) Plain text: %x\n", test_3PT) test_CT = grasshopper.Encrypt(example_K,example_PT) fmt.Printf("(2) Cipher text: %x\n", test_CT) test_2PT = grasshopper.Decrypt_L(example_K,test_CT) fmt.Printf("(2.1) Plain text: %s\n", test_2PT) test_3PT = grasshopper.Decrypt(example_K,test_CT) fmt.Printf("(2.2) Plain text: %s\n", test_3PT) fmt.Println("Done!") }