feat(go): Port full Ananta private server to Go architecture

This commit is contained in:
CAtlas0784 committed 2026-10-29 03:12:00 +07:00
1 parent ca2e80f9b7
commit c73d744649
28 files changed
+3585 -57

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
package chacha8
import (
"bytes"
"testing"
)
func TestChaCha8Roundtrip(t *testing.T) {
key := make([]byte, 32)
for i := range key {
key[i] = byte(i + 1)
}
nonce := make([]byte, 12)
for i := range nonce {
nonce[i] = byte(i + 0x10)
}
c1, err := New(key, nonce)
if err != nil {
t.Fatalf("New failed: %v", err)
}
c2, err := New(key, nonce)
if err != nil {
t.Fatalf("New failed: %v", err)
}
original := []byte("Hello, Ananta NetEase UXChaCha8 stream cipher verification!")
data := make([]byte, len(original))
copy(data, original)
c1.XorInPlace(data)
if bytes.Equal(data, original) {
t.Errorf("Ciphertext equals plaintext")
}
c2.XorInPlace(data)
if !bytes.Equal(data, original) {
t.Errorf("Decrypted data != original: got %q, want %q", data, original)
}
}