(*
** 需要cryptgps库
** ocamlfind ocamlopt -package cryptgps -linkpkg -o keygen.exe keygen.ml
*)
open Crypt_blowfish;; (* or Crypt_blowfish32 *)
open Cryptsystem;;
open Cryptmodes;;
let key_gen id =
let (x3, x2, x1, x0) =
Scanf.sscanf id "%4X%4X%4X%4X" (fun a b c d -> a, b, c, d) in
(* 加密Computer ID *)
let k = prepare "ChinaCrackingGroup" in
let (x3,x2,x1,x0) = encrypt_ecb k (x3, x2, x1, x0) in
(* 计算key *)
let k = prepare "CrackingForFun" in
let (x3,x2,x1,x0) = encrypt_ecb k (x3, x2, x1, x0) in
Printf.printf "Unlock Code: %4X%4X%4X%4X\n" x3 x2 x1 x0
let main () =
if Array.length Sys.argv > 1 then key_gen Sys.argv.(1)
else print_endline "usage: keygen <computer ID>";;
main ()