MCPcopy Create free account
hub / github.com/adeljck/PassGet / randomKey

Function randomKey

modules/finalshell/decrypt.go:58–95  ·  view source on GitHub ↗

随机密钥生成

(head []byte)

Source from the content-addressed store, hash-verified

56
57// 随机密钥生成
58func randomKey(head []byte) []byte {
59 ilist := []int{24, 54, 89, 120, 19, 49, 85, 115, 14, 44, 80, 110, 9, 40, 75, 106, 43, 73, 109, 12, 38, 68, 104, 7, 33, 64,
60 99, 3, 28, 59, 94, 125, 112, 16, 51, 82, 107, 11, 46, 77, 103, 6, 41, 72, 98, 1, 37, 67, 4, 35, 70, 101, 0,
61 30, 65, 96, 122, 25, 61, 91, 117, 20, 56, 86, 74, 104, 13, 43, 69, 99, 8, 38, 64, 95, 3, 34, 59, 90, 125,
62 29, 93, 123, 32, 62, 88, 119, 27, 58, 83, 114, 22, 53, 79, 109, 17, 48, 35, 66, 101, 5, 31, 61, 96, 0, 26,
63 56, 92, 122, 21, 51, 87, 117, 55, 85, 120, 24, 50, 80, 116, 19, 45, 75, 111, 14, 40, 71, 106, 10, 50, 81,
64 116, 20, 45, 76, 111, 15, 41, 71, 106, 10, 36, 66, 102, 5, 69, 100, 8, 39, 65, 95, 3, 34, 60, 90, 126, 29,
65 55, 85, 121, 24, 12, 42, 78, 108, 7, 37, 73, 103, 2, 33, 68, 99, 124, 28, 63, 94, 31, 61, 97, 0, 26, 57,
66 92, 123, 21, 52, 87, 118, 17, 47, 82, 113, 100, 4, 39, 70, 96, 126, 34, 65, 91, 121, 30, 60, 86, 116, 25,
67 55, 120, 23, 58, 89, 115, 18, 54, 84, 110, 13, 49, 79, 105, 9, 44, 75, 62, 92, 1, 31, 57, 88, 123, 27, 52,
68 83, 118, 22, 48, 78, 113, 17, 81, 112, 20, 51, 76, 107, 15, 46, 72, 102, 10, 41, 67, 97, 6, 36}
69 i := ilist[head[5]]
70 ks := 3680984568597093857 / int64(i)
71 rand1 := NewRandom(ks)
72 t := head[0]
73
74 for j := 0; j < int(t); j++ {
75 rand1.nextLong()
76 }
77
78 n := rand1.nextLong()
79 rand2 := NewRandom(n)
80
81 ld := []int64{
82 int64(head[4]), rand2.nextLong(), int64(head[7]), int64(head[3]), rand2.nextLong(), int64(head[1]), rand1.nextLong(), int64(head[2]),
83 }
84
85 byteStream := new(bytes.Buffer)
86 for _, l := range ld {
87 err := binary.Write(byteStream, binary.BigEndian, l)
88 if err != nil {
89 return nil
90 }
91 }
92
93 keyData := md5Hash(byteStream.Bytes())[:8]
94 return keyData
95}
96func md5Hash(data []byte) []byte {
97 hash := md5.Sum(data)
98 return hash[:]

Callers 1

DecryptFunction · 0.85

Calls 4

nextLongMethod · 0.95
NewRandomFunction · 0.85
md5HashFunction · 0.85
WriteMethod · 0.80

Tested by

no test coverage detected