Example #1
0
func TestEncrypt(t *testing.T) {
	key := make([]byte, 16)
	rand.Read(key)

	constr1 := saes.Construction{Key: key}
	constr2 := Construction{Key: Expand(key)}

	in, out := make([]byte, 16), make([]byte, 16)
	rand.Read(in)
	constr1.Encrypt(out, in)

	if !constr2.encrypt(Expand(in)).Equals(Expand(out)) {
		t.Fatal("BES Encrypt didn't agree with AES Encrypt!")
	}
}