コード例 #1
0
ファイル: 6_test.go プロジェクト: benpence/matasano
func Test6(t *testing.T) {
	if ciphertext, err := encoding.DecodeBase64([]byte(input6)); err != nil {
		t.Error("Decoding", input6, "failed")

	} else if key, err := repeatingxor.FindKey(ciphertext); err != nil {
		t.Error("repeatingxor.Key returned error:", err)

	} else if plaintext, err := repeatingxor.Crypt(ciphertext, key); err != nil {
		t.Error("repeatingxor.Crypt returned error:", err)

	} else if string(plaintext) != output6 {
		t.Error(string(plaintext), "!=", output6)
	}
}
コード例 #2
0
ファイル: 7_test.go プロジェクト: benpence/matasano
func Test7(t *testing.T) {
	ciphertext, err := encoding.DecodeBase64([]byte(input7))
	if err != nil {
		t.Error("Decoding", input7, "failed")
	}

	plaintext, err := aes.Decrypt(ciphertext, []byte(key7))
	if err != nil {
		t.Error("Decrypting returned error:", err)
	}

	if string(plaintext) != output7 {
		t.Error(string(plaintext), "!=", output7)
	}
}