mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-31 06:26:53 -05:00
another test case for simple authenticator
This commit is contained in:
parent
b5ab714b52
commit
cd4416e7e5
@ -22,6 +22,19 @@ func TestSimpleAuthenticator(t *testing.T) {
|
||||
assert.Bytes(buffer.Value).Equals([]byte{'a', 'b', 'c', 'd', 'e', 'f', 'g'})
|
||||
}
|
||||
|
||||
func TestSimpleAuthenticator2(t *testing.T) {
|
||||
assert := assert.On(t)
|
||||
|
||||
buffer := alloc.NewBuffer().Clear()
|
||||
buffer.AppendBytes('1', '2')
|
||||
|
||||
auth := NewSimpleAuthenticator()
|
||||
auth.Seal(buffer)
|
||||
|
||||
assert.Bool(auth.Open(buffer)).IsTrue()
|
||||
assert.Bytes(buffer.Value).Equals([]byte{'1', '2'})
|
||||
}
|
||||
|
||||
func BenchmarkSimpleAuthenticator(b *testing.B) {
|
||||
buffer := alloc.NewBuffer().Clear()
|
||||
buffer.Slice(0, 1024)
|
||||
|
@ -8,14 +8,15 @@ TEXT ·xorfwd(SB),NOSPLIT,$0
|
||||
ADDQ $4, DI // x[i+4]
|
||||
SUBQ $4, CX
|
||||
loop:
|
||||
CMPL CX, $0
|
||||
JE done
|
||||
|
||||
MOVL (SI), AX
|
||||
XORL AX, (DI)
|
||||
ADDQ $4, SI
|
||||
ADDQ $4, DI
|
||||
SUBQ $4, CX
|
||||
|
||||
CMPL CX, $0
|
||||
JE done
|
||||
|
||||
JMP loop
|
||||
done:
|
||||
RET
|
||||
@ -31,14 +32,16 @@ TEXT ·xorbkd(SB),NOSPLIT,$0
|
||||
SUBQ $4, DI
|
||||
SUBQ $4, CX
|
||||
loop:
|
||||
CMPL CX, $0
|
||||
JE done
|
||||
|
||||
MOVL (SI), AX
|
||||
XORL AX, (DI)
|
||||
SUBQ $4, SI
|
||||
SUBQ $4, DI
|
||||
SUBQ $4, CX
|
||||
|
||||
CMPL CX, $0
|
||||
JE done
|
||||
|
||||
JMP loop
|
||||
|
||||
done:
|
||||
RET
|
||||
|
Loading…
Reference in New Issue
Block a user