|  | @@ -6,21 +6,27 @@ import (
 | 
											
												
													
														|  |  	"testing"
 |  |  	"testing"
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	"v2ray.com/core/common"
 |  |  	"v2ray.com/core/common"
 | 
											
												
													
														|  | 
 |  | +	"v2ray.com/core/common/compare"
 | 
											
												
													
														|  |  	. "v2ray.com/core/proxy/mtproto"
 |  |  	. "v2ray.com/core/proxy/mtproto"
 | 
											
												
													
														|  |  	. "v2ray.com/ext/assert"
 |  |  	. "v2ray.com/ext/assert"
 | 
											
												
													
														|  |  )
 |  |  )
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func TestInverse(t *testing.T) {
 |  |  func TestInverse(t *testing.T) {
 | 
											
												
													
														|  | -	assert := With(t)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +	const size = 64
 | 
											
												
													
														|  |  	b := make([]byte, 64)
 |  |  	b := make([]byte, 64)
 | 
											
												
													
														|  | -	common.Must2(rand.Read(b))
 |  | 
 | 
											
												
													
														|  | 
 |  | +	for b[0] == b[size-1] {
 | 
											
												
													
														|  | 
 |  | +		common.Must2(rand.Read(b))
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	bi := Inverse(b)
 |  |  	bi := Inverse(b)
 | 
											
												
													
														|  | -	assert(b[0], NotEquals, bi[0])
 |  | 
 | 
											
												
													
														|  | 
 |  | +	if b[0] == bi[0] {
 | 
											
												
													
														|  | 
 |  | +		t.Fatal("seems bytes are not inversed: ", b[0], "vs", bi[0])
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	bii := Inverse(bi)
 |  |  	bii := Inverse(bi)
 | 
											
												
													
														|  | -	assert(bii, Equals, b)
 |  | 
 | 
											
												
													
														|  | 
 |  | +	if err := compare.BytesEqualWithDetail(bii, b); err != nil {
 | 
											
												
													
														|  | 
 |  | +		t.Fatal(err)
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func TestAuthenticationReadWrite(t *testing.T) {
 |  |  func TestAuthenticationReadWrite(t *testing.T) {
 |