Skip to content

Commit

Permalink
add go version to increase performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Night12138 committed Oct 23, 2022
1 parent 15f4844 commit ff777bb
Show file tree
Hide file tree
Showing 2,896 changed files with 550,027 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gover/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
proto
*.exe
358 changes: 358 additions & 0 deletions gover/ec2b/aes.go

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions gover/ec2b/ec2b.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package ec2b

import (
"encoding/binary"
"errors"

"github.com/MoonlightPS/Iridium-gidra/gover/utils"
)

var le = binary.LittleEndian

// UnityPlayer:$26EA90
func key_scramble(key []byte) {
round_keys := make([]byte, 11*16)
for round := 0; round <= 10; round++ {
for i := 0; i < 16; i++ {
for j := 0; j < 16; j++ {
idx := (round << 8) + (i * 16) + j
round_keys[round*16+i] ^= aes_xorpad_table[1][idx] ^ aes_xorpad_table[0][idx]
}
}
}
var chip [16]byte
oqs_mhy128_enc_c(key, round_keys, chip[:])
copy(key, chip[:])
}

// UnityPlayer:$19DA40
func get_decrypt_vector(key, crypt []byte) ([]byte, error) {
var val uint64 = 0xFFFFFFFFFFFFFFFF
for i := 0; i < len(crypt)>>3; i++ {
val = le.Uint64(crypt[i<<3:]) ^ val
}

key_hi, key_lo := le.Uint64(key), le.Uint64(key[8:])
mt := utils.NewMT19937_64()
mt.Seed(key_lo ^ 0xCEAC3B5A867837AC ^ val ^ key_hi)

out := make([]byte, 0, utils.DEFAULT_KEY_LEN)
for i := 0; i < utils.DEFAULT_KEY_LEN; i += 8 {
out = le.AppendUint64(out, mt.Int64())
}
return out, nil
}

func Derive(ec2b []byte) ([]byte, error) {
if len(ec2b) != 2076 {
return nil, errors.New("ec2b size must be 2076")
}

var key [16]byte
var data [2048]byte

copy(key[:], ec2b[8:])
copy(data[:], ec2b[28:])

key_scramble(key[:])

for i := 0; i < 16; i++ {
key[i] ^= key_xorpad_table[i]
}

return get_decrypt_vector(key[:], data[:])
}
19 changes: 19 additions & 0 deletions gover/ec2b/ec2b_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ec2b

import (
"encoding/base64"
"fmt"
"testing"
)

func TestEC2B(t *testing.T) {
d, err := base64.StdEncoding.DecodeString("RWMyYhAAAAAwWYAsJ4eUPYFvHj1nCbx+AAgAANWiRkndI305DQe3Tn34avtGlc3re7JUufEwL28on+GAskqBGAS1R72TrgFrOhG81Nh5C67LUHCLTvmjRJnVRoRiDpb61h6Pu3U+xJ5tPdPqZitheRzfPWfdHKvtnlKQT2Me38Pc/JnCGbMj9YkuhddbhnaoQwrIg6Q2tnNjo0dvVJFQgY3KT0C2yPIXvlg81K+dX3b5henGdE9TOe4UUrJBSK795z3IihWa9b9RFCIiU6L22U0GgpD1v/nCc0pGAAn8ML77wcoZqcNMGqc/P9XZXDFikZdAAZfiZr4QqnMZmQLxlNufyPkH7IdLOLy8Xd683wEMMA7TmXxH7w6PnXFDY2CiUtGa82g4PqdiSOIegUMBQvjz2FGdytAXcZEjpN2eUuHkD3hdGmvL7HCjHLaCQyZP0FaW2Xn89xC43D7wm86mb/C1CeDpZhQYintVfShb4at0dyzeQEkKN0n1TH+ARPOgAo6Sb58Q/6mFwgE5HNrTD3nQzaH0TlvNAHUjdFTqmX4NYif6p9Rc4rKORGpXHg8zQnOc079WkWexYnI9F4mcWu3ZFpw3TQ5UJ/1Jp121OkpKtBpUB/15mL+gMxWitgPWg9M59P1udabd2Yr160uF4FyZY+K6DNahJrUFFT6C4bwwxnEnBSKhCO9AUZPuzpdM09JWUImk1FeRnSalZ59+G9i8N415UCw8xl/I1nYBTllcFj8pyTYgchoQ7waTjLL9/zFKQMGoLr7JZIVTUmDdMW7zeV/nIs9g6m5Vn/0HuGlxt3wAR/fM8muvKUlMsyF/xwBwQz79HPquZ67MPMyr3PmN5Ec6Amh6bOUBWuAT39WRnZTvBD2xQQ8EGbNI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vQYxUBFsfHAfzGvuVJOmCwOFWNAp2WyCl6KTSMXHHDFvL1J5TKiCajyjaSeuX0qpD5ho2JZfLluaTJzxAlJDXrRn3Va8qA/sx4KfmlbGegbN8uwpejs3EFPe078QkBLpQBKnqMAagIEKZ+gHj84Q/FA89RUKmFqm1m3QkgQ8u4Gwp6RQBQ1IriaFehLIhN+4JEAuq+KrEYw3x2ujN5C8JO/9Tf2/cV1ORm75U8qyqTOFoDBaMaJl/zekUOWIhM78qE65qnLr9DrS8ugAfGeay/IberydEHeE5aD9I5Kl8zUfbgJzIdf1L7MVswD+ZwGdxKz+9nWFS5vPNJ/ZV2rQJSExKuuymka+WohgwoehKnMDL0rjIjEhg5588c4fq9sJxyl2fLe2VHnQttAUKXROviZylC4/VPVHpqszU1X9tlkJXllDk3g09CKPoaHwfynDtdSxMMFVS5yyFjuU+SgzBUejAn4rc5PrJTXQRtd+wzrivFDyzDkL7bqBFqow3EkaPGvPW0L3ypmow22dzQ7jg+SDBhUvqoUqM4TVmWoEou/7bR/221WsVrEESMpFP8LJT2jgDlLfWvN6Wcxn4FRVxPT/M5z484J9nQJXjxQq7xF3WQ213dcgT63pYQVXLXnMR19N4Y1DQWVDnFbGiU96lX9yCIHHhJIQZXtFoVvGj/H2iunRfrpBxGSObEmHXUTr9iAHdV5l6wheBaiaaHDUvS4CF3B5cPJsJLTEnSkyemBeS5TphtiDiR422irfKxjO++a4nKhNLI9kuAayYye5C")
if err != nil {
panic(err)
}
res, err := Derive(d)
if err != nil {
panic(err)
}
fmt.Println(res[0], res[1], res[2], res[3])
}
Loading

0 comments on commit ff777bb

Please sign in to comment.