mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-12-28 13:05:28 -05:00
more security types in vmess.
This commit is contained in:
24
proxy/vmess/encoding/auth_test.go
Normal file
24
proxy/vmess/encoding/auth_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package encoding_test
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"testing"
|
||||
|
||||
. "v2ray.com/core/proxy/vmess/encoding"
|
||||
"v2ray.com/core/testing/assert"
|
||||
)
|
||||
|
||||
func TestFnvAuth(t *testing.T) {
|
||||
assert := assert.On(t)
|
||||
fnvAuth := new(FnvAuthenticator)
|
||||
|
||||
expectedText := make([]byte, 256)
|
||||
rand.Read(expectedText)
|
||||
|
||||
buffer := make([]byte, 512)
|
||||
b := fnvAuth.Seal(buffer, nil, expectedText, nil)
|
||||
b, err := fnvAuth.Open(buffer, nil, b, nil)
|
||||
assert.Error(err).IsNil()
|
||||
assert.Int(len(b)).Equals(256)
|
||||
assert.Bytes(b).Equals(expectedText)
|
||||
}
|
||||
Reference in New Issue
Block a user