aboutsummaryrefslogtreecommitdiff
path: root/enc/enc.go
diff options
context:
space:
mode:
Diffstat (limited to 'enc/enc.go')
-rw-r--r--enc/enc.go45
1 files changed, 0 insertions, 45 deletions
diff --git a/enc/enc.go b/enc/enc.go
deleted file mode 100644
index 5f7a987..0000000
--- a/enc/enc.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Decrypt Graphtec files
-package main
-
-import (
- "bytes"
- "crypto/cipher"
- "crypto/des"
- "flag"
- "fmt"
- "io/ioutil"
- "log"
-)
-
-var (
- magic = []byte{0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99}
- key = []byte{0x32, 0x5d, 0xbc, 0x97, 0xa8, 0xa1, 0x26, 0x08}
- zero = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- file = flag.String("file", "Graphtec.enc", "file name")
-)
-
-func main() {
- flag.Parse()
-
- f, err := ioutil.ReadFile(*file)
- if err != nil {
- log.Fatal(err)
- }
-
- if !bytes.Equal(f[:8], magic) {
- log.Fatal("bad magic")
- }
-
- block, err := des.NewCipher(key)
- if err != nil {
- log.Fatal(err)
- }
-
- data := f[0x88:]
- mode := cipher.NewCBCDecrypter(block, zero)
- mode.CryptBlocks(data, data)
-
- size := len(data)
- size -= int(data[size-1:][0])
- fmt.Print(string(data[:size]))
-}