mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
VID Hash method
This commit is contained in:
parent
d785fa0156
commit
2566fc3d14
@ -35,7 +35,7 @@
|
|||||||
数据部分
|
数据部分
|
||||||
* N 字节:请求数据
|
* N 字节:请求数据
|
||||||
|
|
||||||
其中指令部分经过 AES-128 加密,Key 为用户 VID;数据部分使用 AES-128-CBC 加密
|
其中指令部分经过 AES-128 加密,Key 为 md5(用户 VID + 'PWD');数据部分使用 AES-128-CBC 加密
|
||||||
|
|
||||||
## 数据应答
|
## 数据应答
|
||||||
认证部分:
|
认证部分:
|
||||||
|
8
vid.go
8
vid.go
@ -1,6 +1,7 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/md5"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
@ -8,6 +9,13 @@ import (
|
|||||||
// The ID of en entity, in the form of an UUID.
|
// The ID of en entity, in the form of an UUID.
|
||||||
type VID [16]byte
|
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}
|
var byteGroups = []int{8, 4, 4, 4, 12}
|
||||||
|
|
||||||
// TODO: leverage a full functional UUID library
|
// TODO: leverage a full functional UUID library
|
||||||
|
5
vuserset.go
Normal file
5
vuserset.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package core
|
||||||
|
|
||||||
|
type VUserSet struct {
|
||||||
|
validUserIds [][]byte
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user