1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-20 14:35:23 +00:00

VID Hash method

This commit is contained in:
V2Ray 2015-09-07 23:48:19 +02:00
parent d785fa0156
commit 2566fc3d14
3 changed files with 14 additions and 1 deletions

View File

@ -35,7 +35,7 @@
数据部分
* N 字节:请求数据
其中指令部分经过 AES-128 加密Key 为用户 VID数据部分使用 AES-128-CBC 加密
其中指令部分经过 AES-128 加密Key 为 md5(用户 VID + 'PWD');数据部分使用 AES-128-CBC 加密
## 数据应答
认证部分:

8
vid.go
View File

@ -1,6 +1,7 @@
package core
import (
"crypto/md5"
"encoding/hex"
"fmt"
)
@ -8,6 +9,13 @@ import (
// The ID of en entity, in the form of an UUID.
type VID [16]byte
func (v VID) Hash(suffix []byte) []byte {
md5 := md5.New()
md5.Write(v[:])
md5.Write(suffix)
return md5.Sum(nil)
}
var byteGroups = []int{8, 4, 4, 4, 12}
// TODO: leverage a full functional UUID library

5
vuserset.go Normal file
View File

@ -0,0 +1,5 @@
package core
type VUserSet struct {
validUserIds [][]byte
}