Ejemplo n.º 1
0
    void ack_challenge(int err, wire obj)
    {
        a_accountchallenge ack = (a_accountchallenge)obj;
        string             str = user_passwd.text;

        byte[]         passwd = Tool.sha1(str);
        byte[]         hash   = Tool.hmac(passwd, Encoding.Default.GetString(ack.randomkey));
        r_accountlogin req    = new r_accountlogin();

        req.gateid = 1;
        req.user   = Encoding.Default.GetBytes(user_name.text);
        req.passwd = hash;
        NetInstance.Login.Send(req);
        Debug.Log("[LoginState] ack_challenge randomkey:" + ack.randomkey + " account:" + user_name.text);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        user_name.text   = "findstr";
        user_passwd.text = "asdfg";
        //event
        register_btn.onClick.AddListener(on_register);
        login_btn.onClick.AddListener(on_login);
        //protocol
        a_accountcreate    create       = new a_accountcreate();
        a_accountchallenge challenge    = new a_accountchallenge();
        a_accountlogin     accountlogin = new a_accountlogin();
        a_gatelogin        gatelogin    = new a_gatelogin();

        Register(create, ack_create);
        Register(challenge, ack_challenge);
        Register(accountlogin, ack_accountlogin);
        Register(gatelogin, ack_gatelogin);
    }