首页 > 编程语言 >【软件】Charles激活码计算器(Go & Java)

【软件】Charles激活码计算器(Go & Java)

时间:2024-04-12 14:25:50浏览次数:26  
标签:ck int32 Java name int Charles 激活码 byte rk

✨Charles

https://www.charlesproxy.com/


✨在线激活

https://www.zzzmode.com/mytools/charles/


✨激活码计算器(Go)

在线激活的地址中提供了激活码计算器的代码

防止在线激活跑路

特此保存

package main

import (
	"bytes"
	"encoding/binary"
	"fmt"
	"math/rand"
	"time"
)

const (
	rounds    = 12
	roundKeys = 2 * (rounds + 1)
)

func main() {
	rand.Seed(time.Now().UnixNano())

	name := "Charles"

	fmt.Println("name:", name, "    key:", crack(name))
}

func crack(text string) string {

	name := []byte(text)
	length := len(name) + 4
	padded := ((-length) & (8 - 1)) + length
	bs := make([]byte, 4)
	binary.BigEndian.PutUint32(bs, uint32(len(name)))
	buff := bytes.Buffer{}
	buff.Write(bs)
	buff.Write(name)

	var ckName int64 = 0x7a21c951691cd470
	var ckKey int64 = -5408575981733630035
	ck := newCkCipher(ckName)
	outBuff := bytes.Buffer{}

	for i := 0; i < padded; i += 8 {
		bf := buff.Bytes()[i : i+8]
		buf := bytes.NewBuffer(bf)
		var nowVar int64
		if err := binary.Read(buf, binary.BigEndian, &nowVar); err != nil {
			panic(err)
		}

		dd := ck.encrypt(nowVar)

		outBuff.WriteByte(byte(dd >> 56))
		outBuff.WriteByte(byte(dd >> 48))
		outBuff.WriteByte(byte(dd >> 40))
		outBuff.WriteByte(byte(dd >> 32))
		outBuff.WriteByte(byte(dd >> 24))
		outBuff.WriteByte(byte(dd >> 16))
		outBuff.WriteByte(byte(dd >> 8))
		outBuff.WriteByte(byte(dd))

	}
	var n int32
	for _, b := range outBuff.Bytes() {
		n = rotateLeft(n^int32(int8(b)), 0x3)
	}
	prefix:= n ^ 0x54882f8a
	suffix:=rand.Int31()
	in := int64(prefix) << 32
	s := int64(suffix)
	switch suffix >> 16 {
	case 0x0401:
	case 0x0402:
	case 0x0403:
		in |= s
		break
	default:
		in |= 0x01000000 | (s & 0xffffff)
		break
	}

	out := newCkCipher(ckKey).decrypt(in)

	var n2 int64
	for i := 56; i >= 0; i -= 8 {
		n2 ^= int64((uint64(in) >> i) & 0xff)
	}

	vv := int32(n2 & 0xff)
	if vv < 0 {
		vv = -vv
	}
	return fmt.Sprintf("%02x%016x", vv, uint64(out))
}


type ckCipher struct {
	rk [roundKeys]int32
}

func newCkCipher(ckKey int64) ckCipher {
	ck := ckCipher{}

	var ld [2]int32
	ld[0] = int32(ckKey)
	ld[1] = int32(uint64(ckKey) >> 32)

	ck.rk[0] = -1209970333
	for i := 1; i < roundKeys; i++ {
		ck.rk[i] = ck.rk[i-1] + -1640531527
	}
	var a, b int32
	var i, j int

	for k := 0; k < 3*roundKeys; k++ {
		ck.rk[i] = rotateLeft(ck.rk[i]+(a+b), 3)
		a = ck.rk[i]
		ld[j] = rotateLeft(ld[j]+(a+b), a+b)
		b = ld[j]
		i = (i + 1) % roundKeys
		j = (j + 1) % 2
	}
	return ck
}

func (ck ckCipher) encrypt(in int64) int64 {
	a := int32(in) + ck.rk[0]
	b := int32(uint64(in)>>32) + ck.rk[1]
	for r := 1; r <= rounds; r++ {
		a = rotateLeft(a^b, b) + ck.rk[2*r]
		b = rotateLeft(b^a, a) + ck.rk[2*r+1]
	}
	return pkLong(a, b)
}

func (ck ckCipher) decrypt(in int64) int64 {
	a := int32(in)
	b := int32(uint64(in) >> 32)
	for i := rounds; i > 0; i-- {
		b = rotateRight(b-ck.rk[2*i+1], a) ^ a
		a = rotateRight(a-ck.rk[2*i], b) ^ b
	}
	b -= ck.rk[1]
	a -= ck.rk[0]
	return pkLong(a, b)
}

func rotateLeft(x int32, y int32) int32 {
	return int32(x<<(y&(32-1))) | int32(uint32(x)>>(32-(y&(32-1))))
}

func rotateRight(x int32, y int32) int32 {
	return int32(uint32(x)>>(y&(32-1))) | int32(x<<(32-(y&(32-1))))
}

func pkLong(a int32, b int32) int64 {
	return (int64(a) & 0xffffffff) | (int64(b) << 32)
}

✨激活码计算器(Java)

下面提供Java版本代码

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;

public class CharlesCracked {
    private static final int ROUNDS = 12;
    private static final int ROUND_KEYS = 2 * (ROUNDS + 1);
    private static final Random rand = new Random();

    public static void main(String[] args) {
        rand.setSeed(System.nanoTime());
        String name = "Charles";
        System.out.println("name: " + name + "    key: " + crack(name));
    }

    private static String crack(String text) {
        byte[] name = text.getBytes();
        int length = name.length + 4;
        int padded = ((-length) & (8 - 1)) + length;
        ByteBuffer buffer = ByteBuffer.allocate(padded);
        buffer.order(ByteOrder.BIG_ENDIAN);
        buffer.putInt(name.length);
        buffer.put(name);

        long ckName = 0x7a21c951691cd470L;
        long ckKey = -5408575981733630035L;
        CkCipher ck = new CkCipher(ckName);
        ByteBuffer outBuffer = ByteBuffer.allocate(padded);
        outBuffer.order(ByteOrder.BIG_ENDIAN);

        for (int i = 0; i < padded; i += 8) {
            long nowVar = buffer.getLong(i);
            long dd = ck.encrypt(nowVar);
            outBuffer.putLong(dd);
        }

        int n = 0;
        for (byte b : outBuffer.array()) {
            n = rotateLeft(n ^ (int) b, 3);
        }
        int prefix = n ^ 0x54882f8a;
        int suffix = rand.nextInt();
        long in = ((long) prefix << 32) | (suffix & 0xffffffffL);
        if ((suffix >> 16) == 0x0401 || (suffix >> 16) == 0x0402 || (suffix >> 16) == 0x0403) {
            // Keep `in` as is
        } else {
            in = (in & 0xffffffff00000000L) | 0x01000000L | (suffix & 0xffffff);
        }

        long out = new CkCipher(ckKey).decrypt(in);
        long n2 = 0;
        for (int i = 56; i >= 0; i -= 8) {
            n2 ^= (in >> i) & 0xff;
        }

        int vv = (int) (n2 & 0xff);
        if (vv < 0) vv = -vv;
        return String.format("%02x%016x", vv, out);
    }

    private static class CkCipher {
        private int[] rk = new int[ROUND_KEYS];

        public CkCipher(long ckKey) {
            int[] ld = new int[]{(int) ckKey, (int) (ckKey >>> 32)};
            rk[0] = -1209970333;
            for (int i = 1; i < ROUND_KEYS; i++) {
                rk[i] = rk[i - 1] - 1640531527;
            }
            int a = 0, b = 0, i = 0, j = 0;
            for (int k = 0; k < 3 * ROUND_KEYS; k++) {
                rk[i] = rotateLeft(rk[i] + (a + b), 3);
                a = rk[i];
                ld[j] = rotateLeft(ld[j] + (a + b), a + b);
                b = ld[j];
                i = (i + 1) % ROUND_KEYS;
                j = (j + 1) % 2;
            }
        }

        public long encrypt(long in) {
            int a = (int) in + rk[0];
            int b = (int) (in >>> 32) + rk[1];
            for (int r = 1; r <= ROUNDS; r++) {
                a = rotateLeft(a ^ b, b) + rk[2 * r];
                b = rotateLeft(b ^ a, a) + rk[2 * r + 1];
            }
            return packLong(a, b);
        }

        public long decrypt(long in) {
            int a = (int) in;
            int b = (int) (in >>> 32);
            for (int i = ROUNDS; i > 0; i--) {
                b = rotateRight(b - rk[2 * i + 1], a) ^ a;
                a = rotateRight(a - rk[2 * i], b) ^ b;
            }
            b -= rk[1];
            a -= rk[0];
            return packLong(a, b);
        }
    }

    private static int rotateLeft(int x, int y) {
        return (x << (y & 31)) | (x >>> (32 - (y & 31)));
    }

    private static int rotateRight(int x, int y) {
        return (x >>> (y & 31)) | (x << (32 - (y & 31)));
    }

    private static long packLong(int a, int b) {
        return ((long) a & 0xffffffffL) | ((long) b << 32);
    }
}

✨效果展示

仅供个人学习交流使用,请勿用于任何商业用途。


⭐转载请注明出处

本文作者:双份浓缩馥芮白

原文链接:https://www.cnblogs.com/Flat-White/p/18131085

版权所有,如需转载请注明出处。

标签:ck,int32,Java,name,int,Charles,激活码,byte,rk
From: https://www.cnblogs.com/Flat-White/p/18131085

相关文章

  • Java 中文官方教程 2022 版(七)
    原文:docs.oracle.com/javase/tutorial/reallybigindex.html问题和练习:泛型原文:docs.oracle.com/javase/tutorial/java/generics/QandE/generics-questions.html编写一个通用方法来计算集合中具有特定属性的元素数量(例如,奇数、质数、回文数)。以下类会编译吗?如果不会,为......
  • Java 中文官方教程 2022 版(八)
    原文:docs.oracle.com/javase/tutorial/reallybigindex.html缓冲流原文:docs.oracle.com/javase/tutorial/essential/io/buffers.html到目前为止,我们看到的大多数示例都使用非缓冲的I/O。这意味着每个读取或写入请求都直接由底层操作系统处理。这可能会使程序效率大大降低,因......
  • Java 中文官方教程 2022 版(十)
    原文:docs.oracle.com/javase/tutorial/reallybigindex.htmlExecutors原文:docs.oracle.com/javase/tutorial/essential/concurrency/executors.html在所有先前的示例中,新线程执行的任务与其Runnable对象定义的线程本身(由Thread对象定义)之间存在密切联系。这对于小型应用程序......
  • Java 中文官方教程 2022 版(十一)
    原文:docs.oracle.com/javase/tutorial/reallybigindex.html模式类的方法原文:docs.oracle.com/javase/tutorial/essential/regex/pattern.html到目前为止,我们只使用测试工具来创建Pattern对象的最基本形式。本节探讨了一些高级技术,如使用标志创建模式和使用嵌入式标志表达式......
  • Java 中文官方教程 2022 版(四)
    原文:docs.oracle.com/javase/tutorial/reallybigindex.html方法引用原文:docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html你可以使用lambda表达式来创建匿名方法。然而,有时候lambda表达式仅仅是调用一个已存在的方法。在这种情况下,通过名称引用现有......
  • Java 中文官方教程 2022 版(六)
    原文:docs.oracle.com/javase/tutorial/reallybigindex.html字符和字符串总结原文:docs.oracle.com/javase/tutorial/java/data/stringsummary.html大多数情况下,如果您使用单个字符值,您将使用基本的char类型。然而,有时您需要将char用作对象—例如,作为期望对象的方法参数。J......
  • Java基础学习 | 2024年4月12日
    修饰符1.受保护的访问修饰符-protected子类与基类在同一包中:被声明为protected的变量、方法和构造器能被同一个包中的任何其他类访问;子类与基类不在同一包中:那么在子类中,子类实例可以访问其从基类继承而来的protected方法,而不能访问基类实例的protected方法。简单来讲,被p......
  • java_基础01_数据类型和变量
     1.注释//单行注释/*多行注释*//**javaDoc:文档注释/***@Descriptionhello*//***_ooOoo_*o8888888o*88"."88*......
  • onJava8学习笔记
    onJava8:ThinkingInJavasequel第一章:对象的概念※,复用组合(UML实心三角形)和聚合(UML空心三角形)都属于关联关系的一种,只是额外具有整体-部分的意义。至于是聚合还是组合,需要根据实际的业务需求来判断。可能相同超类和子类,在不同的业务场景,关联关系会发生变化。只看代码是无法......
  • 狂神说Java Web学习笔记_Session
    原理图服务器会给每一个用户(浏览器)创建一个session对象一个session独占一个浏览器,主要浏览器没有关,这个session就存在登录之后,整个网站都可以访问常用场景保存一个用户的登录信息在整个网站中经常会使用到的数据常用的session方法//得到SessionHttpSessionsession=re......