github.com/sandwich-go/boost@v1.3.29/xcrypto/algorithm/vigenere/vigenere_test.go (about)

     1  package vigenere
     2  
     3  import (
     4  	. "github.com/smartystreets/goconvey/convey"
     5  	"testing"
     6  )
     7  
     8  func TestVigenere(t *testing.T) {
     9  	Convey("test vigenere encryption", t, func() {
    10  		So(Sanitize([]byte("123456789")), ShouldBeEmpty)
    11  		a := Sanitize([]byte("123456789ABC"))
    12  		So(len(a), ShouldEqual, 3)
    13  		b := "GHIJKLMNO"
    14  		c := Encrypt([]byte(b), a)
    15  		So(b, ShouldEqual, string(Decrypt(c, a)))
    16  
    17  		b1 := []byte(b)
    18  		EncryptAndInplace(b1, a)
    19  		So(b, ShouldNotEqual, string(b1))
    20  		DecryptAndInplace(b1, a)
    21  		So(b, ShouldEqual, string(b1))
    22  	})
    23  }